From 6f6486e97743eadfb20b4175e1b4b2b05b59a17a Mon Sep 17 00:00:00 2001 From: Jatin Bhateja Date: Tue, 31 May 2022 16:02:09 +0000 Subject: [PATCH] 8284960: Integration of JEP 426: Vector API (Fourth Incubator) Co-authored-by: Jatin Bhateja Co-authored-by: Paul Sandoz Co-authored-by: Sandhya Viswanathan Co-authored-by: Smita Kamath Co-authored-by: Joshua Zhu Co-authored-by: Xiaohong Gong Co-authored-by: John R Rose Co-authored-by: Eric Liu Co-authored-by: Ningsheng Jian Reviewed-by: ngasson, vlivanov, mcimadamore, jlahoda, kvn --- src/hotspot/cpu/aarch64/aarch64.ad | 7 +- src/hotspot/cpu/aarch64/aarch64_neon.ad | 210 +++++- src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 | 134 +++- src/hotspot/cpu/aarch64/aarch64_sve.ad | 321 ++++++++- src/hotspot/cpu/aarch64/aarch64_sve_ad.m4 | 245 ++++++- src/hotspot/cpu/aarch64/assembler_aarch64.hpp | 31 + .../cpu/aarch64/c2_MacroAssembler_aarch64.cpp | 151 ++++ .../cpu/aarch64/c2_MacroAssembler_aarch64.hpp | 16 + src/hotspot/cpu/x86/assembler_x86.cpp | 257 ++++++- src/hotspot/cpu/x86/assembler_x86.hpp | 36 +- src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp | 610 ++++++++++++++-- src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp | 99 ++- src/hotspot/cpu/x86/macroAssembler_x86.cpp | 14 +- src/hotspot/cpu/x86/macroAssembler_x86.hpp | 5 + src/hotspot/cpu/x86/matcher_x86.hpp | 20 +- src/hotspot/cpu/x86/stubGenerator_x86_32.cpp | 123 +++- src/hotspot/cpu/x86/stubGenerator_x86_64.cpp | 82 ++- src/hotspot/cpu/x86/stubRoutines_x86.cpp | 5 + src/hotspot/cpu/x86/stubRoutines_x86.hpp | 25 + src/hotspot/cpu/x86/vm_version_x86.cpp | 3 + src/hotspot/cpu/x86/vm_version_x86.hpp | 11 +- src/hotspot/cpu/x86/x86.ad | 419 ++++++++++- src/hotspot/share/adlc/formssel.cpp | 6 +- src/hotspot/share/classfile/vmIntrinsics.hpp | 25 +- src/hotspot/share/opto/c2compiler.cpp | 1 + src/hotspot/share/opto/classes.hpp | 11 + src/hotspot/share/opto/library_call.cpp | 2 + src/hotspot/share/opto/library_call.hpp | 2 + src/hotspot/share/opto/loopTransform.cpp | 3 + src/hotspot/share/opto/matcher.cpp | 3 + src/hotspot/share/opto/mulnode.hpp | 16 + src/hotspot/share/opto/node.hpp | 16 +- src/hotspot/share/opto/subnode.hpp | 20 + src/hotspot/share/opto/superword.cpp | 10 +- src/hotspot/share/opto/vectorIntrinsics.cpp | 148 +++- src/hotspot/share/opto/vectornode.cpp | 79 ++- src/hotspot/share/opto/vectornode.hpp | 69 +- src/hotspot/share/prims/vectorSupport.cpp | 103 +++ src/hotspot/share/prims/vectorSupport.hpp | 12 + src/hotspot/share/runtime/vmStructs.cpp | 7 + .../share/utilities/globalDefinitions.hpp | 4 + .../misc/X-ScopedMemoryAccess.java.template | 203 +++--- .../jdk/internal/vm/vector/VectorSupport.java | 58 +- src/java.base/share/classes/module-info.java | 2 + .../com/sun/tools/javac/code/Preview.java | 20 +- .../com/sun/tools/javac/comp/Check.java | 2 +- .../com/sun/tools/javac/util/Names.java | 2 + .../jdk/incubator/vector/AbstractMask.java | 125 +++- .../jdk/incubator/vector/AbstractSpecies.java | 21 +- .../jdk/incubator/vector/AbstractVector.java | 31 +- .../jdk/incubator/vector/Byte128Vector.java | 68 +- .../jdk/incubator/vector/Byte256Vector.java | 68 +- .../jdk/incubator/vector/Byte512Vector.java | 68 +- .../jdk/incubator/vector/Byte64Vector.java | 68 +- .../jdk/incubator/vector/ByteMaxVector.java | 68 +- .../jdk/incubator/vector/ByteVector.java | 584 ++++++++-------- .../jdk/incubator/vector/Double128Vector.java | 68 +- .../jdk/incubator/vector/Double256Vector.java | 68 +- .../jdk/incubator/vector/Double512Vector.java | 68 +- .../jdk/incubator/vector/Double64Vector.java | 68 +- .../jdk/incubator/vector/DoubleMaxVector.java | 68 +- .../jdk/incubator/vector/DoubleVector.java | 549 +++++++-------- .../jdk/incubator/vector/Float128Vector.java | 68 +- .../jdk/incubator/vector/Float256Vector.java | 68 +- .../jdk/incubator/vector/Float512Vector.java | 68 +- .../jdk/incubator/vector/Float64Vector.java | 68 +- .../jdk/incubator/vector/FloatMaxVector.java | 68 +- .../jdk/incubator/vector/FloatVector.java | 549 +++++++-------- .../jdk/incubator/vector/Int128Vector.java | 68 +- .../jdk/incubator/vector/Int256Vector.java | 68 +- .../jdk/incubator/vector/Int512Vector.java | 68 +- .../jdk/incubator/vector/Int64Vector.java | 68 +- .../jdk/incubator/vector/IntMaxVector.java | 68 +- .../jdk/incubator/vector/IntVector.java | 563 +++++++-------- .../jdk/incubator/vector/Long128Vector.java | 68 +- .../jdk/incubator/vector/Long256Vector.java | 68 +- .../jdk/incubator/vector/Long512Vector.java | 68 +- .../jdk/incubator/vector/Long64Vector.java | 68 +- .../jdk/incubator/vector/LongMaxVector.java | 68 +- .../jdk/incubator/vector/LongVector.java | 563 +++++++-------- .../jdk/incubator/vector/Short128Vector.java | 68 +- .../jdk/incubator/vector/Short256Vector.java | 68 +- .../jdk/incubator/vector/Short512Vector.java | 68 +- .../jdk/incubator/vector/Short64Vector.java | 68 +- .../jdk/incubator/vector/ShortMaxVector.java | 68 +- .../jdk/incubator/vector/ShortVector.java | 586 ++++++++-------- .../classes/jdk/incubator/vector/Vector.java | 198 +++--- .../incubator/vector/VectorIntrinsics.java | 33 +- .../jdk/incubator/vector/VectorMask.java | 47 +- .../jdk/incubator/vector/VectorOperators.java | 28 + .../jdk/incubator/vector/VectorSpecies.java | 68 +- .../incubator/vector/X-Vector.java.template | 652 +++++++++-------- .../vector/X-VectorBits.java.template | 68 +- .../src/jdk/vm/ci/amd64/AMD64.java | 2 + test/hotspot/gtest/aarch64/aarch64-asmtest.py | 12 + test/hotspot/gtest/aarch64/asmtest.out.h | 182 ++--- .../vectorapi/TestIntrinsicBailOut.java | 14 +- .../vectorapi/TestVectorErgonomics.java | 14 +- .../compiler/vectorapi/VectorMemoryAlias.java | 9 +- .../vectorapi/VectorRebracket128Test.java | 30 +- .../vectorapi/reshape/TestVectorCastAVX1.java | 3 +- .../vectorapi/reshape/TestVectorCastAVX2.java | 3 +- .../reshape/TestVectorCastAVX512.java | 3 +- .../reshape/TestVectorCastAVX512BW.java | 3 +- .../reshape/TestVectorCastAVX512DQ.java | 3 +- .../vectorapi/reshape/TestVectorCastNeon.java | 3 +- .../vectorapi/reshape/TestVectorCastSVE.java | 3 +- .../reshape/TestVectorReinterpret.java | 3 +- .../tests/TestVectorDoubleExpandShrink.java | 27 +- .../reshape/tests/TestVectorExpandShrink.java | 27 +- .../reshape/utils/VectorReshapeHelper.java | 29 +- .../vectorization/TestPopCountVectorLong.java | 6 +- .../vector/AbstractVectorLoadStoreTest.java | 12 + .../vector/Byte128VectorLoadStoreTests.java | 465 +++---------- .../incubator/vector/Byte128VectorTests.java | 580 ++++++++++------ .../vector/Byte256VectorLoadStoreTests.java | 465 +++---------- .../incubator/vector/Byte256VectorTests.java | 580 ++++++++++------ .../vector/Byte512VectorLoadStoreTests.java | 465 +++---------- .../incubator/vector/Byte512VectorTests.java | 580 ++++++++++------ .../vector/Byte64VectorLoadStoreTests.java | 465 +++---------- .../incubator/vector/Byte64VectorTests.java | 580 ++++++++++------ .../vector/ByteMaxVectorLoadStoreTests.java | 467 +++---------- .../incubator/vector/ByteMaxVectorTests.java | 580 ++++++++++------ .../vector/Double128VectorLoadStoreTests.java | 476 +++---------- .../vector/Double128VectorTests.java | 343 +++++---- .../vector/Double256VectorLoadStoreTests.java | 476 +++---------- .../vector/Double256VectorTests.java | 343 +++++---- .../vector/Double512VectorLoadStoreTests.java | 476 +++---------- .../vector/Double512VectorTests.java | 343 +++++---- .../vector/Double64VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Double64VectorTests.java | 343 +++++---- .../vector/DoubleMaxVectorLoadStoreTests.java | 478 +++---------- .../vector/DoubleMaxVectorTests.java | 343 +++++---- .../vector/Float128VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Float128VectorTests.java | 342 +++++---- .../vector/Float256VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Float256VectorTests.java | 342 +++++---- .../vector/Float512VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Float512VectorTests.java | 342 +++++---- .../vector/Float64VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Float64VectorTests.java | 342 +++++---- .../vector/FloatMaxVectorLoadStoreTests.java | 478 +++---------- .../incubator/vector/FloatMaxVectorTests.java | 342 +++++---- .../vector/Int128VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Int128VectorTests.java | 657 ++++++++++++------ .../vector/Int256VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Int256VectorTests.java | 657 ++++++++++++------ .../vector/Int512VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Int512VectorTests.java | 657 ++++++++++++------ .../vector/Int64VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Int64VectorTests.java | 657 ++++++++++++------ .../vector/IntMaxVectorLoadStoreTests.java | 478 +++---------- .../incubator/vector/IntMaxVectorTests.java | 657 ++++++++++++------ .../vector/Long128VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Long128VectorTests.java | 655 +++++++++++------ .../vector/Long256VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Long256VectorTests.java | 655 +++++++++++------ .../vector/Long512VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Long512VectorTests.java | 655 +++++++++++------ .../vector/Long64VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Long64VectorTests.java | 655 +++++++++++------ .../vector/LongMaxVectorLoadStoreTests.java | 478 +++---------- .../incubator/vector/LongMaxVectorTests.java | 655 +++++++++++------ .../vector/Short128VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Short128VectorTests.java | 581 ++++++++++------ .../vector/Short256VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Short256VectorTests.java | 581 ++++++++++------ .../vector/Short512VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Short512VectorTests.java | 581 ++++++++++------ .../vector/Short64VectorLoadStoreTests.java | 476 +++---------- .../incubator/vector/Short64VectorTests.java | 581 ++++++++++------ .../vector/ShortMaxVectorLoadStoreTests.java | 478 +++---------- .../incubator/vector/ShortMaxVectorTests.java | 581 ++++++++++------ .../incubator/vector/VectorReshapeTests.java | 26 +- test/jdk/jdk/incubator/vector/gen-template.sh | 21 +- test/jdk/jdk/incubator/vector/gen-tests.sh | 1 - .../Unit-Binary-Broadcast-op-math.template | 1 + .../templates/Unit-Binary-op-math.template | 1 + .../vector/templates/Unit-Binary-op.template | 1 + .../Unit-BoolReduction-Scalar-op.template | 1 + .../templates/Unit-BoolReduction-op.template | 1 + .../vector/templates/Unit-Broadcast.template | 4 - .../templates/Unit-Compare-Broadcast.template | 2 - .../templates/Unit-Compare-Masked.template | 2 +- .../vector/templates/Unit-Compare.template | 1 - .../templates/Unit-CompressExpand.template | 36 + .../vector/templates/Unit-Get-op.template | 1 + .../templates/Unit-Miscellaneous.template | 39 ++ .../Unit-Reduction-Masked-op-func.template | 1 + .../Unit-Reduction-Masked-op.template | 1 + ...t-Reduction-Scalar-Masked-op-func.template | 1 + .../Unit-Reduction-Scalar-Masked-op.template | 1 + .../Unit-Reduction-Scalar-op-func.template | 1 + .../Unit-Reduction-Scalar-op.template | 1 + .../templates/Unit-Reduction-op-func.template | 1 + .../templates/Unit-Reduction-op.template | 1 + .../templates/Unit-Shift-Scalar-op.template | 1 + .../vector/templates/Unit-Shift-op.template | 1 + .../vector/templates/Unit-Single-op.template | 1 + .../templates/Unit-Slice-Masked-bop.template | 1 + .../vector/templates/Unit-Slice-bop.template | 1 + .../vector/templates/Unit-Slice-op.template | 1 + .../Unit-Ternary-Broadcast-Masked-op.template | 1 + .../Unit-Ternary-Broadcast-op.template | 1 + ...ernary-Double-Broadcast-Masked-op.template | 1 + .../Unit-Ternary-Double-Broadcast-op.template | 1 + .../templates/Unit-Ternary-Masked-op.template | 1 + .../templates/Unit-Ternary-Scalar-op.template | 1 + .../vector/templates/Unit-Ternary-op.template | 1 + .../vector/templates/Unit-Test.template | 1 + .../templates/Unit-Unary-op-math.template | 1 + .../Unit-Unslice-Masked-bop.template | 1 + .../templates/Unit-Unslice-bop.template | 1 + .../vector/templates/Unit-Unslice-op.template | 1 + .../vector/templates/Unit-Zero.template | 4 - .../vector/templates/Unit-footer.template | 1 - .../vector/templates/Unit-header.template | 116 +++- .../templates/X-LoadStoreTest.java.template | 488 +++---------- .../jdk/test/whitebox/CPUInfoTest.java | 2 +- .../jdk/incubator/vector/BlackScholes.java | 2 +- .../vector/MaskCastOperationsBenchmark.java | 224 ++++++ .../vector/MaskQueryOperationsBenchmark.java | 20 + .../jdk/incubator/vector/MaskedLogicOpts.java | 1 + .../vector/MemorySegmentVectorAccess.java | 164 +++++ .../jdk/incubator/vector/RotateBenchmark.java | 1 + .../incubator/vector/TestLoadStoreBytes.java | 120 +--- ...oreShort.java => TestLoadStoreShorts.java} | 95 +-- 227 files changed, 20949 insertions(+), 21221 deletions(-) create mode 100644 test/jdk/jdk/incubator/vector/templates/Unit-CompressExpand.template create mode 100644 test/micro/org/openjdk/bench/jdk/incubator/vector/MaskCastOperationsBenchmark.java create mode 100644 test/micro/org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java rename test/micro/org/openjdk/bench/jdk/incubator/vector/{TestLoadStoreShort.java => TestLoadStoreShorts.java} (58%) diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index bfd19c05025..5d302b08be4 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -2468,6 +2468,9 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType break; case Op_LoadVectorGather: case Op_StoreVectorScatter: + case Op_CompressV: + case Op_CompressM: + case Op_ExpandV: return false; default: break; @@ -8658,7 +8661,6 @@ instruct countTrailingZerosL(iRegINoSp dst, iRegL src) %{ // instruct popCountI(iRegINoSp dst, iRegIorL2I src, vRegF tmp) %{ - predicate(UsePopCountInstruction); match(Set dst (PopCountI src)); effect(TEMP tmp); ins_cost(INSN_COST * 13); @@ -8680,7 +8682,6 @@ instruct popCountI(iRegINoSp dst, iRegIorL2I src, vRegF tmp) %{ %} instruct popCountI_mem(iRegINoSp dst, memory4 mem, vRegF tmp) %{ - predicate(UsePopCountInstruction); match(Set dst (PopCountI (LoadI mem))); effect(TEMP tmp); ins_cost(INSN_COST * 13); @@ -8703,7 +8704,6 @@ instruct popCountI_mem(iRegINoSp dst, memory4 mem, vRegF tmp) %{ // Note: Long.bitCount(long) returns an int. instruct popCountL(iRegINoSp dst, iRegL src, vRegD tmp) %{ - predicate(UsePopCountInstruction); match(Set dst (PopCountL src)); effect(TEMP tmp); ins_cost(INSN_COST * 13); @@ -8723,7 +8723,6 @@ instruct popCountL(iRegINoSp dst, iRegL src, vRegD tmp) %{ %} instruct popCountL_mem(iRegINoSp dst, memory8 mem, vRegD tmp) %{ - predicate(UsePopCountInstruction); match(Set dst (PopCountL (LoadL mem))); effect(TEMP tmp); ins_cost(INSN_COST * 13); diff --git a/src/hotspot/cpu/aarch64/aarch64_neon.ad b/src/hotspot/cpu/aarch64/aarch64_neon.ad index 946b591e7ac..e16e7e286cf 100644 --- a/src/hotspot/cpu/aarch64/aarch64_neon.ad +++ b/src/hotspot/cpu/aarch64/aarch64_neon.ad @@ -5683,14 +5683,58 @@ instruct vround2D_reg(vecX dst, vecX src, immI rmode) %{ ins_pipe(vdop_fp128); %} -instruct vpopcount4I(vecX dst, vecX src) %{ - predicate(UsePopCountInstruction && n->as_Vector()->length() == 4); +instruct vpopcountID(vecD dst, vecD src) %{ + predicate(n->as_Vector()->length_in_bytes() < 16); match(Set dst (PopCountVI src)); - format %{ - "cnt $dst, $src\t# vector (16B)\n\t" - "uaddlp $dst, $dst\t# vector (16B)\n\t" - "uaddlp $dst, $dst\t# vector (8H)" + ins_cost(3 * INSN_COST); + format %{ "vpopcountI $dst, $src\t# vector (8B/4H/2S)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + __ cnt(as_FloatRegister($dst$$reg), __ T8B, + as_FloatRegister($src$$reg)); + if (bt == T_SHORT || bt == T_INT) { + __ uaddlp(as_FloatRegister($dst$$reg), __ T8B, + as_FloatRegister($dst$$reg)); + if (bt == T_INT) { + __ uaddlp(as_FloatRegister($dst$$reg), __ T4H, + as_FloatRegister($dst$$reg)); + } + } %} + ins_pipe(pipe_class_default); +%} + +instruct vpopcountIX(vecX dst, vecX src) %{ + predicate(n->as_Vector()->length_in_bytes() == 16); + match(Set dst (PopCountVI src)); + ins_cost(3 * INSN_COST); + format %{ "vpopcountI $dst, $src\t# vector (16B/8H/4S)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + __ cnt(as_FloatRegister($dst$$reg), __ T16B, + as_FloatRegister($src$$reg)); + if (bt == T_SHORT || bt == T_INT) { + __ uaddlp(as_FloatRegister($dst$$reg), __ T16B, + as_FloatRegister($dst$$reg)); + if (bt == T_INT) { + __ uaddlp(as_FloatRegister($dst$$reg), __ T8H, + as_FloatRegister($dst$$reg)); + } + } + %} + ins_pipe(pipe_class_default); +%} + +// If the PopCountVL is generated by auto-vectorization, the dst basic +// type is T_INT. And once we have unified the type definition for +// Vector API and auto-vectorization, this rule can be merged with +// "vpopcountLX" rule. +instruct vpopcountLD(vecD dst, vecX src) %{ + predicate(n->as_Vector()->length_in_bytes() < 16 && + n->bottom_type()->is_vect()->element_basic_type() == T_INT); + match(Set dst (PopCountVL src)); + ins_cost(5 * INSN_COST); + format %{ "vpopcountL $dst, $src\t# vector (2S)" %} ins_encode %{ __ cnt(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($src$$reg)); @@ -5698,24 +5742,28 @@ instruct vpopcount4I(vecX dst, vecX src) %{ as_FloatRegister($dst$$reg)); __ uaddlp(as_FloatRegister($dst$$reg), __ T8H, as_FloatRegister($dst$$reg)); + __ uaddlp(as_FloatRegister($dst$$reg), __ T4S, + as_FloatRegister($dst$$reg)); + __ xtn(as_FloatRegister($dst$$reg), __ T2S, + as_FloatRegister($dst$$reg), __ T2D); %} ins_pipe(pipe_class_default); %} -instruct vpopcount2I(vecD dst, vecD src) %{ - predicate(UsePopCountInstruction && n->as_Vector()->length() == 2); - match(Set dst (PopCountVI src)); - format %{ - "cnt $dst, $src\t# vector (8B)\n\t" - "uaddlp $dst, $dst\t# vector (8B)\n\t" - "uaddlp $dst, $dst\t# vector (4H)" - %} +instruct vpopcountLX(vecX dst, vecX src) %{ + predicate(n->as_Vector()->length_in_bytes() == 16 && + n->bottom_type()->is_vect()->element_basic_type() == T_LONG); + match(Set dst (PopCountVL src)); + ins_cost(4 * INSN_COST); + format %{ "vpopcountL $dst, $src\t# vector (2D)" %} ins_encode %{ - __ cnt(as_FloatRegister($dst$$reg), __ T8B, + __ cnt(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($src$$reg)); - __ uaddlp(as_FloatRegister($dst$$reg), __ T8B, + __ uaddlp(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($dst$$reg)); - __ uaddlp(as_FloatRegister($dst$$reg), __ T4H, + __ uaddlp(as_FloatRegister($dst$$reg), __ T8H, + as_FloatRegister($dst$$reg)); + __ uaddlp(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($dst$$reg)); %} ins_pipe(pipe_class_default); @@ -5921,3 +5969,131 @@ instruct vmask_tolong16B(iRegLNoSp dst, vecX src) %{ %} ins_pipe(pipe_slow); %} + +//------------------------- CountLeadingZerosV ----------------------------- + +instruct countLeadingZerosVD(vecD dst, vecD src) %{ + predicate(n->as_Vector()->length_in_bytes() == 8); + match(Set dst (CountLeadingZerosV src)); + ins_cost(INSN_COST); + format %{ "countLeadingZerosV $dst, $src\t# vector (8B/4H/2S)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_Arrangement size = __ esize2arrangement((unsigned)type2aelembytes(bt), false); + __ clz(as_FloatRegister($dst$$reg), size, as_FloatRegister($src$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct countLeadingZerosVX(vecX dst, vecX src) %{ + predicate(n->as_Vector()->length_in_bytes() == 16); + match(Set dst (CountLeadingZerosV src)); + ins_cost(INSN_COST); + format %{ "countLeadingZerosV $dst, $src\t# vector (16B/8H/4S/2D)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_Arrangement size = __ esize2arrangement((unsigned)type2aelembytes(bt), true); + if (bt != T_LONG) { + __ clz(as_FloatRegister($dst$$reg), size, as_FloatRegister($src$$reg)); + } else { + __ umov(rscratch1, as_FloatRegister($src$$reg), __ D, 0); + __ clz(rscratch1, rscratch1); + __ mov(as_FloatRegister($dst$$reg), __ D, 0, rscratch1); + __ umov(rscratch1, as_FloatRegister($src$$reg), __ D, 1); + __ clz(rscratch1, rscratch1); + __ mov(as_FloatRegister($dst$$reg), __ D, 1, rscratch1); + } + %} + ins_pipe(pipe_slow); +%} + +//------------------------- CountTrailingZerosV ---------------------------- + +instruct countTrailingZerosVD(vecD dst, vecD src) %{ + predicate(n->as_Vector()->length_in_bytes() == 8); + match(Set dst (CountTrailingZerosV src)); + ins_cost(3 * INSN_COST); + format %{ "countTrailingZerosV $dst, $src\t# vector (8B/4H/2S)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_Arrangement size = __ esize2arrangement((unsigned)type2aelembytes(bt), false); + __ neon_reverse_bits(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), bt, false); + __ clz(as_FloatRegister($dst$$reg), size, as_FloatRegister($dst$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct countTrailingZerosVX(vecX dst, vecX src) %{ + predicate(n->as_Vector()->length_in_bytes() == 16); + match(Set dst (CountTrailingZerosV src)); + ins_cost(3 * INSN_COST); + format %{ "countTrailingZerosV $dst, $src\t# vector (16B/8H/4S/2D)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_Arrangement size = __ esize2arrangement((unsigned)type2aelembytes(bt), true); + __ neon_reverse_bits(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), bt, true); + if (bt != T_LONG) { + __ clz(as_FloatRegister($dst$$reg), size, as_FloatRegister($dst$$reg)); + } else { + __ umov(rscratch1, as_FloatRegister($dst$$reg), __ D, 0); + __ clz(rscratch1, rscratch1); + __ mov(as_FloatRegister($dst$$reg), __ D, 0, rscratch1); + __ umov(rscratch1, as_FloatRegister($dst$$reg), __ D, 1); + __ clz(rscratch1, rscratch1); + __ mov(as_FloatRegister($dst$$reg), __ D, 1, rscratch1); + } + %} + ins_pipe(pipe_slow); +%} + +//------------------------------ ReverseV ----------------------------------- + +instruct vreverseD(vecD dst, vecD src) %{ + predicate(n->as_Vector()->length_in_bytes() == 8); + match(Set dst (ReverseV src)); + ins_cost(2 * INSN_COST); + format %{ "ReverseV $dst, $src\t# vector (D)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + __ neon_reverse_bits(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), bt, false); + %} + ins_pipe(pipe_slow); +%} + +instruct vreverseX(vecX dst, vecX src) %{ + predicate(n->as_Vector()->length_in_bytes() == 16); + match(Set dst (ReverseV src)); + ins_cost(2 * INSN_COST); + format %{ "ReverseV $dst, $src\t# vector (X)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + __ neon_reverse_bits(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), bt, true); + %} + ins_pipe(pipe_slow); +%} + +//---------------------------- ReverseBytesV -------------------------------- + +instruct vreverseBytesD(vecD dst, vecD src) %{ + predicate(n->as_Vector()->length_in_bytes() == 8); + match(Set dst (ReverseBytesV src)); + ins_cost(INSN_COST); + format %{ "ReverseBytesV $dst, $src\t# vector (D)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + __ neon_reverse_bytes(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), bt, false); + %} + ins_pipe(pipe_slow); +%} + +instruct vreverseBytesX(vecX dst, vecX src) %{ + predicate(n->as_Vector()->length_in_bytes() == 16); + match(Set dst (ReverseBytesV src)); + ins_cost(INSN_COST); + format %{ "ReverseBytesV $dst, $src\t# vector (X)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + __ neon_reverse_bytes(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), bt, true); + %} + ins_pipe(pipe_slow); +%} diff --git a/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 b/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 index 9b62c148df4..51fbc7d2c6d 100644 --- a/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 +++ b/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 @@ -2445,28 +2445,50 @@ instruct vround2D_reg(vecX dst, vecX src, immI rmode) %{ ins_pipe(vdop_fp128); %} dnl -define(`VPOPCOUNT', ` -instruct vpopcount$1$2`'(vec$5 dst, vec$5 src) %{ - predicate(UsePopCountInstruction && n->as_Vector()->length() == $1); - match(Set dst (PopCountVI src)); - format %{ - "cnt $dst, $src\t# vector ($3B)\n\t" - "uaddlp $dst, $dst\t# vector ($3B)\n\t" - "uaddlp $dst, $dst\t# vector ($4H)" - %} - ins_encode %{ - __ cnt(as_FloatRegister($dst$$reg), __ T$3B, - as_FloatRegister($src$$reg)); - __ uaddlp(as_FloatRegister($dst$$reg), __ T$3B, +define(`VPOPCOUNT', `dnl +ifelse($1$2, `LD', ` +// If the PopCountVL is generated by auto-vectorization, the dst basic +// type is T_INT. And once we have unified the type definition for +// Vector API and auto-vectorization, this rule can be merged with +// "vpopcountLX" rule.', `') +instruct vpopcount$1$2`'(vec$2 dst, vec$3 src) %{ + predicate(n->as_Vector()->length_in_bytes() $4 16`'ifelse($1$2, `LD', ` && + n->bottom_type()->is_vect()->element_basic_type() == T_INT', $1$2, `LX', ` && + n->bottom_type()->is_vect()->element_basic_type() == T_LONG', `')); + match(Set dst (PopCountV$1 src)); + ins_cost($5 * INSN_COST); + format %{ "vpopcount$1 $dst, $src\t# vector ($6)" %} + ins_encode %{dnl +ifelse($1, `I', ` + BasicType bt = Matcher::vector_element_basic_type(this);', `') + __ cnt(as_FloatRegister($dst$$reg), __ T`'ifelse($3, D, 8, 16)B, + as_FloatRegister($src$$reg));dnl +ifelse($1, `L', ` + __ uaddlp(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($dst$$reg)); - __ uaddlp(as_FloatRegister($dst$$reg), __ T$4H, + __ uaddlp(as_FloatRegister($dst$$reg), __ T8H, as_FloatRegister($dst$$reg)); + __ uaddlp(as_FloatRegister($dst$$reg), __ T4S, + as_FloatRegister($dst$$reg));', ` + if (bt == T_SHORT || bt == T_INT) { + __ uaddlp(as_FloatRegister($dst$$reg), __ T`'ifelse($2, D, 8, 16)B, + as_FloatRegister($dst$$reg)); + if (bt == T_INT) { + __ uaddlp(as_FloatRegister($dst$$reg), __ T`'ifelse($2, D, 4, 8)H, + as_FloatRegister($dst$$reg)); + } + }')dnl +ifelse($1$2, `LD', ` + __ xtn(as_FloatRegister($dst$$reg), __ T2S, + as_FloatRegister($dst$$reg), __ T2D);', `') %} ins_pipe(pipe_class_default); %}')dnl -dnl $1 $2 $3 $4 $5 -VPOPCOUNT(4, I, 16, 8, X) -VPOPCOUNT(2, I, 8, 4, D) +dnl $1 $2 $3 $4 $5 $6 +VPOPCOUNT(I, D, D, <, 3, 8B/4H/2S) +VPOPCOUNT(I, X, X, ==, 3, 16B/8H/4S) +VPOPCOUNT(L, D, X, <, 5, 2S) +VPOPCOUNT(L, X, X, ==, 4, 2D) dnl dnl VMASK_TRUECOUNT($1, $2 ) dnl VMASK_TRUECOUNT(suffix, reg) @@ -2647,3 +2669,81 @@ instruct vmask_tolong16B(iRegLNoSp dst, vecX src) %{ %} ins_pipe(pipe_slow); %} + +dnl +dnl CLTZ_D($1 ) +dnl CLTZ_D(op_name) +define(`CLTZ_D', ` +instruct count$1D(vecD dst, vecD src) %{ + predicate(n->as_Vector()->length_in_bytes() == 8); + match(Set dst (Count$1 src)); + ins_cost(ifelse($1, `TrailingZerosV', `3 * ', `')INSN_COST); + format %{ "count$1 $dst, $src\t# vector (8B/4H/2S)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_Arrangement size = __ esize2arrangement((unsigned)type2aelembytes(bt), false);dnl +ifelse($1, `TrailingZerosV', ` + __ neon_reverse_bits(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), bt, false);', `') + __ clz(as_FloatRegister($dst$$reg), size, as_FloatRegister($ifelse($1, `TrailingZerosV', dst, src)$$reg)); + %} + ins_pipe(pipe_slow); +%}')dnl +dnl +dnl CLTZ_X($1 ) +dnl CLTZ_X(op_name) +define(`CLTZ_X', ` +instruct count$1X(vecX dst, vecX src) %{ + predicate(n->as_Vector()->length_in_bytes() == 16); + match(Set dst (Count$1 src)); + ins_cost(ifelse($1, `TrailingZerosV', `3 * ', `')INSN_COST); + format %{ "count$1 $dst, $src\t# vector (16B/8H/4S/2D)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_Arrangement size = __ esize2arrangement((unsigned)type2aelembytes(bt), true);dnl +ifelse($1, `TrailingZerosV', ` + __ neon_reverse_bits(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), bt, true);', `') + if (bt != T_LONG) { + __ clz(as_FloatRegister($dst$$reg), size, as_FloatRegister($ifelse($1, `TrailingZerosV', dst, src)$$reg)); + } else { + __ umov(rscratch1, as_FloatRegister($ifelse($1, `TrailingZerosV', dst, src)$$reg), __ D, 0); + __ clz(rscratch1, rscratch1); + __ mov(as_FloatRegister($dst$$reg), __ D, 0, rscratch1); + __ umov(rscratch1, as_FloatRegister($ifelse($1, `TrailingZerosV', dst, src)$$reg), __ D, 1); + __ clz(rscratch1, rscratch1); + __ mov(as_FloatRegister($dst$$reg), __ D, 1, rscratch1); + } + %} + ins_pipe(pipe_slow); +%}')dnl +dnl +//------------------------- CountLeadingZerosV ----------------------------- +CLTZ_D(LeadingZerosV) +CLTZ_X(LeadingZerosV) + +//------------------------- CountTrailingZerosV ---------------------------- +CLTZ_D(TrailingZerosV) +CLTZ_X(TrailingZerosV) + +dnl +dnl REVERSE($1, $2, $3, $4 ) +dnl REVERSE(insn_name, op_name, type, insn) +define(`REVERSE', ` +instruct $1(vec$3 dst, vec$3 src) %{ + predicate(n->as_Vector()->length_in_bytes() == ifelse($3, D, 8, 16)); + match(Set dst ($2 src)); + ins_cost(ifelse($2, `ReverseV', `2 * ', `')INSN_COST); + format %{ "$2 $dst, $src\t# vector ($3)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + __ $4(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), bt, ifelse($3, D, false, true)); + %} + ins_pipe(pipe_slow); +%}')dnl +dnl +//------------------------------ ReverseV ----------------------------------- +REVERSE(vreverseD, ReverseV, D, neon_reverse_bits) +REVERSE(vreverseX, ReverseV, X, neon_reverse_bits) + +//---------------------------- ReverseBytesV -------------------------------- +REVERSE(vreverseBytesD, ReverseBytesV, D, neon_reverse_bytes) +REVERSE(vreverseBytesX, ReverseBytesV, X, neon_reverse_bytes) diff --git a/src/hotspot/cpu/aarch64/aarch64_sve.ad b/src/hotspot/cpu/aarch64/aarch64_sve.ad index 835fd566143..ba9747d0bd5 100644 --- a/src/hotspot/cpu/aarch64/aarch64_sve.ad +++ b/src/hotspot/cpu/aarch64/aarch64_sve.ad @@ -149,6 +149,8 @@ source %{ case Op_LoadVector: case Op_StoreVector: return Matcher::vector_size_supported(bt, vlen); + case Op_ExpandV: + if (UseSVE < 2 || is_subword_type(bt)) return false; case Op_VectorMaskToLong: if (vlen > 64) return false; default: @@ -2199,14 +2201,83 @@ instruct vnegD_masked(vReg dst_src, pRegGov pg) %{ ins_pipe(pipe_slow); %} -// popcount vector +// vector popcount instruct vpopcountI(vReg dst, vReg src) %{ - predicate(UseSVE > 0); + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector()); match(Set dst (PopCountVI src)); - format %{ "sve_cnt $dst, $src\t# vector (sve) (S)\n\t" %} + ins_cost(SVE_COST); + format %{ "sve_cnt $dst, $src\t# vector (sve) (B/H/S)" %} ins_encode %{ - __ sve_cnt(as_FloatRegister($dst$$reg), __ S, ptrue, as_FloatRegister($src$$reg)); + BasicType bt = Matcher::vector_element_basic_type(this); + __ sve_cnt(as_FloatRegister($dst$$reg), __ elemType_to_regVariant(bt), + ptrue, as_FloatRegister($src$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct vpopcountL(vReg dst, vReg src) %{ + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector() && + n->bottom_type()->is_vect()->element_basic_type() == T_LONG); + match(Set dst (PopCountVL src)); + ins_cost(SVE_COST); + format %{ "sve_cnt $dst, $src\t# vector (sve) (D)" %} + ins_encode %{ + __ sve_cnt(as_FloatRegister($dst$$reg), __ D, + ptrue, as_FloatRegister($src$$reg)); + %} + ins_pipe(pipe_slow); +%} + +// If the PopCountVL is generated by auto-vectorization, the dst basic +// type is T_INT. And once we have unified the type definition for +// Vector API and auto-vectorization, this rule can be merged with +// "vpopcountL" rule. +instruct vpopcountLI(vReg dst, vReg src, vReg vtmp) %{ + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector() && + n->bottom_type()->is_vect()->element_basic_type() == T_INT); + match(Set dst (PopCountVL src)); + effect(TEMP_DEF dst, TEMP vtmp); + ins_cost(3 * SVE_COST); + format %{ "sve_cnt $dst, $src\n\t" + "sve_dup $vtmp, #0\n\t" + "sve_uzp1 $dst, $dst, $vtmp\t# vector (sve) (S)" %} + ins_encode %{ + __ sve_cnt(as_FloatRegister($dst$$reg), __ D, + ptrue, as_FloatRegister($src$$reg)); + __ sve_vector_narrow(as_FloatRegister($dst$$reg), __ S, + as_FloatRegister($dst$$reg), __ D, as_FloatRegister($vtmp$$reg)); + %} + ins_pipe(pipe_slow); +%} + +// vector popcount - predicated + +instruct vpopcountI_masked(vReg dst_src, pRegGov pg) %{ + predicate(UseSVE > 0); + match(Set dst_src (PopCountVI dst_src pg)); + ins_cost(SVE_COST); + format %{ "sve_cnt $dst_src, $pg, $dst_src\t# vector (sve) (B/H/S)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + __ sve_cnt(as_FloatRegister($dst_src$$reg), __ elemType_to_regVariant(bt), + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct vpopcountL_masked(vReg dst_src, pRegGov pg) %{ + predicate(UseSVE > 0 && + n->bottom_type()->is_vect()->element_basic_type() == T_LONG); + match(Set dst_src (PopCountVL dst_src pg)); + ins_cost(SVE_COST); + format %{ "sve_cnt $dst_src, $pg, $dst_src\t# vector (sve) (D)" %} + ins_encode %{ + __ sve_cnt(as_FloatRegister($dst_src$$reg), __ D, + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg)); %} ins_pipe(pipe_slow); %} @@ -5767,6 +5838,104 @@ instruct vloadmask_extend(pRegGov dst, vReg src, vReg tmp, rFlagsReg cr) %{ ins_pipe(pipe_slow); %} +// ---------------------------- Compress/Expand Operations --------------------------- + +instruct mcompress(pReg dst, pReg pg, rFlagsReg cr) %{ + predicate(UseSVE > 0); + match(Set dst (CompressM pg)); + effect(KILL cr); + ins_cost(2 * SVE_COST); + format %{ "sve_cntp rscratch1, $pg\n\t" + "sve_whilelo $dst, zr, rscratch1\t# mask compress (B/H/S/D)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_cntp(rscratch1, size, ptrue, as_PRegister($pg$$reg)); + __ sve_whilelo(as_PRegister($dst$$reg), size, zr, rscratch1); + %} + ins_pipe(pipe_slow); +%} + +instruct vcompress(vReg dst, vReg src, pRegGov pg) %{ + predicate(UseSVE > 0 && + (n->bottom_type()->is_vect()->element_basic_type() == T_INT || + n->bottom_type()->is_vect()->element_basic_type() == T_FLOAT || + n->bottom_type()->is_vect()->element_basic_type() == T_LONG || + n->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE)); + match(Set dst (CompressV src pg)); + ins_cost(SVE_COST); + format %{ "sve_compact $dst, $src, $pg\t# vector compress (S/D)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_compact(as_FloatRegister($dst$$reg), size, as_FloatRegister($src$$reg), as_PRegister($pg$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct vcompressB(vReg dst, vReg src, pReg pg, vReg vtmp1, vReg vtmp2, vReg vtmp3, vReg vtmp4, + pReg ptmp, pRegGov pgtmp) %{ + predicate(UseSVE > 0 && n->bottom_type()->is_vect()->element_basic_type() == T_BYTE); + effect(TEMP_DEF dst, TEMP vtmp1, TEMP vtmp2, TEMP vtmp3, TEMP vtmp4, TEMP ptmp, TEMP pgtmp); + match(Set dst (CompressV src pg)); + ins_cost(13 * SVE_COST); + format %{ "sve_compact $dst, $src, $pg\t# vector compress (B)" %} + ins_encode %{ + __ sve_compress_byte(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), as_PRegister($pg$$reg), + as_FloatRegister($vtmp1$$reg),as_FloatRegister($vtmp2$$reg), + as_FloatRegister($vtmp3$$reg),as_FloatRegister($vtmp4$$reg), + as_PRegister($ptmp$$reg), as_PRegister($pgtmp$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct vcompressS(vReg dst, vReg src, pReg pg, vReg vtmp1, vReg vtmp2, pRegGov pgtmp) %{ + predicate(UseSVE > 0 && n->bottom_type()->is_vect()->element_basic_type() == T_SHORT); + effect(TEMP_DEF dst, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp); + match(Set dst (CompressV src pg)); + ins_cost(38 * SVE_COST); + format %{ "sve_compact $dst, $src, $pg\t# vector compress (H)" %} + ins_encode %{ + __ sve_compress_short(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), as_PRegister($pg$$reg), + as_FloatRegister($vtmp1$$reg),as_FloatRegister($vtmp2$$reg), as_PRegister($pgtmp$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct vexpand(vReg dst, vReg src, pRegGov pg) %{ + match(Set dst (ExpandV src pg)); + effect(TEMP_DEF dst); + ins_cost(4 * SVE_COST); + format %{ "sve_dup $dst, S/D, 0\n\t" + "sve_histcnt $dst, S/D, $pg, $dst, $dst\n\t" + "sve_sub $dst, S/D, 1\n\t" + "sve_tbl $dst, S/D, $src, $dst\t# vector expand (S/D)" %} + ins_encode %{ + // Example input: src = 1 2 3 4 5 6 7 8 + // pg = 1 0 0 1 1 0 1 1 + // Expected result: dst = 4 0 0 5 6 0 7 8 + + // The basic idea is to use TBL which can shuffle the elements in the given + // vector flexibly. HISTCNT + SUB is used to generate the second source input + // for TBL whose value is used to select the indexed element from src vector. + + BasicType bt = Matcher::vector_element_basic_type(this); + assert(UseSVE == 2 && !is_subword_type(bt), "unsupported"); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + // dst = 0 0 0 0 0 0 0 0 + __ sve_dup(as_FloatRegister($dst$$reg), size, 0); + // dst = 5 0 0 4 3 0 2 1 + __ sve_histcnt(as_FloatRegister($dst$$reg), size, as_PRegister($pg$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg)); + // dst = 4 -1 -1 3 2 -1 1 0 + __ sve_sub(as_FloatRegister($dst$$reg), size, 1); + // dst = 4 0 0 5 6 0 7 8 + __ sve_tbl(as_FloatRegister($dst$$reg), size, as_FloatRegister($src$$reg), + as_FloatRegister($dst$$reg)); + %} + ins_pipe(pipe_slow); +%} + instruct vmask_gen(pRegGov pg, iRegL len, rFlagsReg cr) %{ predicate(UseSVE > 0); match(Set pg (VectorMaskGen len)); @@ -5780,3 +5949,147 @@ instruct vmask_gen(pRegGov pg, iRegL len, rFlagsReg cr) %{ %} ins_pipe(pipe_slow); %} + +// ------------------------------ CountLeadingZerosV ------------------------------ + +instruct vcountLeadingZeros(vReg dst, vReg src) %{ + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector()); + match(Set dst (CountLeadingZerosV src)); + ins_cost(SVE_COST); + format %{ "sve_clz $dst, $src\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_clz(as_FloatRegister($dst$$reg), size, ptrue, as_FloatRegister($src$$reg)); + %} + ins_pipe(pipe_slow); +%} + +// The dst and src should use the same register to make sure the +// inactive lanes in dst save the same elements as src. +instruct vcountLeadingZeros_masked(vReg dst_src, pRegGov pg) %{ + predicate(UseSVE > 0); + match(Set dst_src (CountLeadingZerosV dst_src pg)); + ins_cost(SVE_COST); + format %{ "sve_clz $dst_src, $pg, $dst_src\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_clz(as_FloatRegister($dst_src$$reg), size, + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg)); + %} + ins_pipe(pipe_slow); +%} + +// ------------------------------ CountTrailingZerosV ----------------------------- + +instruct vcountTrailingZeros(vReg dst, vReg src) %{ + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector()); + match(Set dst (CountTrailingZerosV src)); + ins_cost(2 * SVE_COST); + format %{ "sve_rbit $dst, $src\n\t" + "sve_clz $dst, $dst\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_rbit(as_FloatRegister($dst$$reg), size, ptrue, as_FloatRegister($src$$reg)); + __ sve_clz(as_FloatRegister($dst$$reg), size, ptrue, as_FloatRegister($dst$$reg)); + %} + ins_pipe(pipe_slow); +%} + +// The dst and src should use the same register to make sure the +// inactive lanes in dst save the same elements as src. +instruct vcountTrailingZeros_masked(vReg dst_src, pRegGov pg) %{ + predicate(UseSVE > 0); + match(Set dst_src (CountTrailingZerosV dst_src pg)); + ins_cost(2 * SVE_COST); + format %{ "sve_rbit $dst_src, $pg, $dst_src\n\t" + "sve_clz $dst_src, $pg, $dst_src\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_rbit(as_FloatRegister($dst_src$$reg), size, + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg)); + __ sve_clz(as_FloatRegister($dst_src$$reg), size, + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg)); + %} + ins_pipe(pipe_slow); +%} + +// ---------------------------------- ReverseV ------------------------------------ + +instruct vreverse(vReg dst, vReg src) %{ + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector()); + match(Set dst (ReverseV src)); + ins_cost(SVE_COST); + format %{ "sve_rbit $dst, $src\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_rbit(as_FloatRegister($dst$$reg), size, ptrue, as_FloatRegister($src$$reg)); + %} + ins_pipe(pipe_slow); +%} + +// The dst and src should use the same register to make sure the +// inactive lanes in dst save the same elements as src. +instruct vreverse_masked(vReg dst_src, pRegGov pg) %{ + predicate(UseSVE > 0); + match(Set dst_src (ReverseV dst_src pg)); + ins_cost(SVE_COST); + format %{ "sve_rbit $dst_src, $pg, $dst_src\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_rbit(as_FloatRegister($dst_src$$reg), size, + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg)); + %} + ins_pipe(pipe_slow); +%} + +// -------------------------------- ReverseBytesV --------------------------------- + +instruct vreverseBytes(vReg dst, vReg src) %{ + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector()); + match(Set dst (ReverseBytesV src)); + ins_cost(SVE_COST); + format %{ "sve_revb $dst, $src\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + if (bt == T_BYTE) { + if (as_FloatRegister($dst$$reg) != as_FloatRegister($src$$reg)) { + __ sve_orr(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), as_FloatRegister($src$$reg)); + } + } else { + __ sve_revb(as_FloatRegister($dst$$reg), size, ptrue, as_FloatRegister($src$$reg)); + } + %} + ins_pipe(pipe_slow); +%} + +// The dst and src should use the same register to make sure the +// inactive lanes in dst save the same elements as src. +instruct vreverseBytes_masked(vReg dst_src, pRegGov pg) %{ + predicate(UseSVE > 0); + match(Set dst_src (ReverseBytesV dst_src pg)); + ins_cost(SVE_COST); + format %{ "sve_revb $dst_src, $pg, $dst_src\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + if (bt == T_BYTE) { + // do nothing + } else { + __ sve_revb(as_FloatRegister($dst_src$$reg), size, + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg)); + } + %} + ins_pipe(pipe_slow); +%} + diff --git a/src/hotspot/cpu/aarch64/aarch64_sve_ad.m4 b/src/hotspot/cpu/aarch64/aarch64_sve_ad.m4 index ff86c2df51e..bed171293a5 100644 --- a/src/hotspot/cpu/aarch64/aarch64_sve_ad.m4 +++ b/src/hotspot/cpu/aarch64/aarch64_sve_ad.m4 @@ -144,6 +144,8 @@ source %{ case Op_LoadVector: case Op_StoreVector: return Matcher::vector_size_supported(bt, vlen); + case Op_ExpandV: + if (UseSVE < 2 || is_subword_type(bt)) return false; case Op_VectorMaskToLong: if (vlen > 64) return false; default: @@ -1172,18 +1174,75 @@ UNARY_OP_PREDICATE(vnegL, NegVL, D, sve_neg) UNARY_OP_PREDICATE(vnegF, NegVF, S, sve_fneg) UNARY_OP_PREDICATE(vnegD, NegVD, D, sve_fneg) -// popcount vector +dnl +dnl VPOPCOUNT($1, $2 ) +dnl VPOPCOUNT(name_suffix, size) +define(`VPOPCOUNT', ` +instruct vpopcount$1(vReg dst, vReg src) %{ + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector()`'ifelse($1, `L', ` && + n->bottom_type()->is_vect()->element_basic_type() == T_LONG', `')); + match(Set dst (PopCountV$1 src)); + ins_cost(SVE_COST); + format %{ "sve_cnt $dst, $src\t# vector (sve) ($2)" %} + ins_encode %{dnl +ifelse($1, `I', ` + BasicType bt = Matcher::vector_element_basic_type(this);', `') + __ sve_cnt(as_FloatRegister($dst$$reg), ifelse($1, `I', `__ elemType_to_regVariant(bt)', `__ D'), + ptrue, as_FloatRegister($src$$reg)); + %} + ins_pipe(pipe_slow); +%}')dnl +dnl +// vector popcount +VPOPCOUNT(I, B/H/S) +VPOPCOUNT(L, D) -instruct vpopcountI(vReg dst, vReg src) %{ - predicate(UseSVE > 0); - match(Set dst (PopCountVI src)); - format %{ "sve_cnt $dst, $src\t# vector (sve) (S)\n\t" %} +// If the PopCountVL is generated by auto-vectorization, the dst basic +// type is T_INT. And once we have unified the type definition for +// Vector API and auto-vectorization, this rule can be merged with +// "vpopcountL" rule. +instruct vpopcountLI(vReg dst, vReg src, vReg vtmp) %{ + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector() && + n->bottom_type()->is_vect()->element_basic_type() == T_INT); + match(Set dst (PopCountVL src)); + effect(TEMP_DEF dst, TEMP vtmp); + ins_cost(3 * SVE_COST); + format %{ "sve_cnt $dst, $src\n\t" + "sve_dup $vtmp, #0\n\t" + "sve_uzp1 $dst, $dst, $vtmp\t# vector (sve) (S)" %} ins_encode %{ - __ sve_cnt(as_FloatRegister($dst$$reg), __ S, ptrue, as_FloatRegister($src$$reg)); + __ sve_cnt(as_FloatRegister($dst$$reg), __ D, + ptrue, as_FloatRegister($src$$reg)); + __ sve_vector_narrow(as_FloatRegister($dst$$reg), __ S, + as_FloatRegister($dst$$reg), __ D, as_FloatRegister($vtmp$$reg)); %} ins_pipe(pipe_slow); %} +dnl +dnl VPOPCOUNT_PREDICATE($1, $2 ) +dnl VPOPCOUNT_PREDICATE(name_suffix, size) +define(`VPOPCOUNT_PREDICATE', ` +instruct vpopcount$1_masked(vReg dst_src, pRegGov pg) %{ + predicate(UseSVE > 0`'ifelse($1, `L', ` && + n->bottom_type()->is_vect()->element_basic_type() == T_LONG', `')); + match(Set dst_src (PopCountV$1 dst_src pg)); + ins_cost(SVE_COST); + format %{ "sve_cnt $dst_src, $pg, $dst_src\t# vector (sve) ($2)" %} + ins_encode %{dnl +ifelse($1, `I', ` + BasicType bt = Matcher::vector_element_basic_type(this);', `') + __ sve_cnt(as_FloatRegister($dst_src$$reg), ifelse($1, `I', `__ elemType_to_regVariant(bt)', `__ D'), + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg)); + %} + ins_pipe(pipe_slow); +%}')dnl +// vector popcount - predicated +VPOPCOUNT_PREDICATE(I, B/H/S) +VPOPCOUNT_PREDICATE(L, D) + // vector blend instruct vblend(vReg dst, vReg src1, vReg src2, pRegGov pg) %{ @@ -3234,6 +3293,104 @@ instruct vloadmask_extend(pRegGov dst, vReg src, vReg tmp, rFlagsReg cr) %{ ins_pipe(pipe_slow); %} +// ---------------------------- Compress/Expand Operations --------------------------- + +instruct mcompress(pReg dst, pReg pg, rFlagsReg cr) %{ + predicate(UseSVE > 0); + match(Set dst (CompressM pg)); + effect(KILL cr); + ins_cost(2 * SVE_COST); + format %{ "sve_cntp rscratch1, $pg\n\t" + "sve_whilelo $dst, zr, rscratch1\t# mask compress (B/H/S/D)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_cntp(rscratch1, size, ptrue, as_PRegister($pg$$reg)); + __ sve_whilelo(as_PRegister($dst$$reg), size, zr, rscratch1); + %} + ins_pipe(pipe_slow); +%} + +instruct vcompress(vReg dst, vReg src, pRegGov pg) %{ + predicate(UseSVE > 0 && + (n->bottom_type()->is_vect()->element_basic_type() == T_INT || + n->bottom_type()->is_vect()->element_basic_type() == T_FLOAT || + n->bottom_type()->is_vect()->element_basic_type() == T_LONG || + n->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE)); + match(Set dst (CompressV src pg)); + ins_cost(SVE_COST); + format %{ "sve_compact $dst, $src, $pg\t# vector compress (S/D)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + __ sve_compact(as_FloatRegister($dst$$reg), size, as_FloatRegister($src$$reg), as_PRegister($pg$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct vcompressB(vReg dst, vReg src, pReg pg, vReg vtmp1, vReg vtmp2, vReg vtmp3, vReg vtmp4, + pReg ptmp, pRegGov pgtmp) %{ + predicate(UseSVE > 0 && n->bottom_type()->is_vect()->element_basic_type() == T_BYTE); + effect(TEMP_DEF dst, TEMP vtmp1, TEMP vtmp2, TEMP vtmp3, TEMP vtmp4, TEMP ptmp, TEMP pgtmp); + match(Set dst (CompressV src pg)); + ins_cost(13 * SVE_COST); + format %{ "sve_compact $dst, $src, $pg\t# vector compress (B)" %} + ins_encode %{ + __ sve_compress_byte(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), as_PRegister($pg$$reg), + as_FloatRegister($vtmp1$$reg),as_FloatRegister($vtmp2$$reg), + as_FloatRegister($vtmp3$$reg),as_FloatRegister($vtmp4$$reg), + as_PRegister($ptmp$$reg), as_PRegister($pgtmp$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct vcompressS(vReg dst, vReg src, pReg pg, vReg vtmp1, vReg vtmp2, pRegGov pgtmp) %{ + predicate(UseSVE > 0 && n->bottom_type()->is_vect()->element_basic_type() == T_SHORT); + effect(TEMP_DEF dst, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp); + match(Set dst (CompressV src pg)); + ins_cost(38 * SVE_COST); + format %{ "sve_compact $dst, $src, $pg\t# vector compress (H)" %} + ins_encode %{ + __ sve_compress_short(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), as_PRegister($pg$$reg), + as_FloatRegister($vtmp1$$reg),as_FloatRegister($vtmp2$$reg), as_PRegister($pgtmp$$reg)); + %} + ins_pipe(pipe_slow); +%} + +instruct vexpand(vReg dst, vReg src, pRegGov pg) %{ + match(Set dst (ExpandV src pg)); + effect(TEMP_DEF dst); + ins_cost(4 * SVE_COST); + format %{ "sve_dup $dst, S/D, 0\n\t" + "sve_histcnt $dst, S/D, $pg, $dst, $dst\n\t" + "sve_sub $dst, S/D, 1\n\t" + "sve_tbl $dst, S/D, $src, $dst\t# vector expand (S/D)" %} + ins_encode %{ + // Example input: src = 1 2 3 4 5 6 7 8 + // pg = 1 0 0 1 1 0 1 1 + // Expected result: dst = 4 0 0 5 6 0 7 8 + + // The basic idea is to use TBL which can shuffle the elements in the given + // vector flexibly. HISTCNT + SUB is used to generate the second source input + // for TBL whose value is used to select the indexed element from src vector. + + BasicType bt = Matcher::vector_element_basic_type(this); + assert(UseSVE == 2 && !is_subword_type(bt), "unsupported"); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt); + // dst = 0 0 0 0 0 0 0 0 + __ sve_dup(as_FloatRegister($dst$$reg), size, 0); + // dst = 5 0 0 4 3 0 2 1 + __ sve_histcnt(as_FloatRegister($dst$$reg), size, as_PRegister($pg$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg)); + // dst = 4 -1 -1 3 2 -1 1 0 + __ sve_sub(as_FloatRegister($dst$$reg), size, 1); + // dst = 4 0 0 5 6 0 7 8 + __ sve_tbl(as_FloatRegister($dst$$reg), size, as_FloatRegister($src$$reg), + as_FloatRegister($dst$$reg)); + %} + ins_pipe(pipe_slow); +%} + instruct vmask_gen(pRegGov pg, iRegL len, rFlagsReg cr) %{ predicate(UseSVE > 0); match(Set pg (VectorMaskGen len)); @@ -3247,3 +3404,79 @@ instruct vmask_gen(pRegGov pg, iRegL len, rFlagsReg cr) %{ %} ins_pipe(pipe_slow); %} + +dnl +dnl BITWISE_UNARY($1, $2, $3 ) +dnl BITWISE_UNARY(insn_name, op_name, insn) +define(`BITWISE_UNARY', ` +instruct $1(vReg dst, vReg src) %{ + predicate(UseSVE > 0 && + !n->as_Vector()->is_predicated_vector()); + match(Set dst ($2 src)); + ins_cost(ifelse($2, `CountTrailingZerosV', `2 * ', `')SVE_COST); + format %{ ifelse($2, `CountTrailingZerosV', `"sve_rbit $dst, $src\n\t" + "$3 $dst, $dst', `"$3 $dst, $src')\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt);dnl +ifelse($2, `CountTrailingZerosV', ` + __ sve_rbit(as_FloatRegister($dst$$reg), size, ptrue, as_FloatRegister($src$$reg));', `')dnl +ifelse($2, `ReverseBytesV', ` + if (bt == T_BYTE) { + if (as_FloatRegister($dst$$reg) != as_FloatRegister($src$$reg)) { + __ sve_orr(as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), as_FloatRegister($src$$reg)); + } + } else { + __ $3(as_FloatRegister($dst$$reg), size, ptrue, as_FloatRegister($src$$reg)); + }', ` + __ $3(as_FloatRegister($dst$$reg), size, ptrue, as_FloatRegister($ifelse($2, `CountTrailingZerosV', dst, src)$$reg));') + %} + ins_pipe(pipe_slow); +%}')dnl +dnl +dnl BITWISE_UNARY_PREDICATE($1, $2, $3 ) +dnl BITWISE_UNARY_PREDICATE(insn_name, op_name, insn) +define(`BITWISE_UNARY_PREDICATE', ` +// The dst and src should use the same register to make sure the +// inactive lanes in dst save the same elements as src. +instruct $1_masked(vReg dst_src, pRegGov pg) %{ + predicate(UseSVE > 0); + match(Set dst_src ($2 dst_src pg)); + ins_cost(ifelse($2, `CountTrailingZerosV', `2 * ', `')SVE_COST); + format %{ ifelse($2, `CountTrailingZerosV', `"sve_rbit $dst_src, $pg, $dst_src\n\t" + "$3 $dst_src, $pg, $dst_src', `"$3 $dst_src, $pg, $dst_src')\t# vector (sve)" %} + ins_encode %{ + BasicType bt = Matcher::vector_element_basic_type(this); + Assembler::SIMD_RegVariant size = __ elemType_to_regVariant(bt);dnl +ifelse($2, `CountTrailingZerosV', ` + __ sve_rbit(as_FloatRegister($dst_src$$reg), size, + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg));', `')dnl +ifelse($2, `ReverseBytesV', ` + if (bt == T_BYTE) { + // do nothing + } else { + __ $3(as_FloatRegister($dst_src$$reg), size, + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg)); + }', ` + __ $3(as_FloatRegister($dst_src$$reg), size, + as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg));') + %} + ins_pipe(pipe_slow); +%}')dnl +dnl +// ------------------------------ CountLeadingZerosV ------------------------------ +BITWISE_UNARY(vcountLeadingZeros, CountLeadingZerosV, sve_clz) +BITWISE_UNARY_PREDICATE(vcountLeadingZeros, CountLeadingZerosV, sve_clz) + +// ------------------------------ CountTrailingZerosV ----------------------------- +BITWISE_UNARY(vcountTrailingZeros, CountTrailingZerosV, sve_clz) +BITWISE_UNARY_PREDICATE(vcountTrailingZeros, CountTrailingZerosV, sve_clz) + +// ---------------------------------- ReverseV ------------------------------------ +BITWISE_UNARY(vreverse, ReverseV, sve_rbit) +BITWISE_UNARY_PREDICATE(vreverse, ReverseV, sve_rbit) + +// -------------------------------- ReverseBytesV --------------------------------- +BITWISE_UNARY(vreverseBytes, ReverseBytesV, sve_revb) +BITWISE_UNARY_PREDICATE(vreverseBytes, ReverseBytesV, sve_revb) + diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp index eff610751df..8b0cf23a130 100644 --- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp @@ -3134,6 +3134,7 @@ public: INSN(sve_andv, 0b00000100, 0b011010001); // bitwise and reduction to scalar INSN(sve_asr, 0b00000100, 0b010000100); // vector arithmetic shift right INSN(sve_bic, 0b00000100, 0b011011000); // vector bitwise clear + INSN(sve_clz, 0b00000100, 0b011001101); // vector count leading zero bits INSN(sve_cnt, 0b00000100, 0b011010101); // count non-zero bits INSN(sve_cpy, 0b00000101, 0b100000100); // copy scalar to each active vector element INSN(sve_eor, 0b00000100, 0b011001000); // vector eor @@ -3793,6 +3794,19 @@ void sve_fcm(Condition cond, PRegister Pd, SIMD_RegVariant T, INSN(sve_lastb, 0b1); #undef INSN +// SVE reverse within elements +#define INSN(NAME, opc, cond) \ + void NAME(FloatRegister Zd, SIMD_RegVariant T, PRegister Pg, FloatRegister Zn) { \ + starti; \ + assert(cond, "invalid size"); \ + f(0b00000101, 31, 24), f(T, 23, 22), f(0b1001, 21, 18), f(opc, 17, 16); \ + f(0b100, 15, 13), pgrf(Pg, 10), rf(Zn, 5), rf(Zd, 0); \ + } + + INSN(sve_revb, 0b00, T == H || T == S || T == D); + INSN(sve_rbit, 0b11, T != Q); +#undef INSN + // SVE Create index starting from general-purpose register and incremented by immediate void sve_index(FloatRegister Zd, SIMD_RegVariant T, Register Rn, int imm) { starti; @@ -3819,6 +3833,23 @@ void sve_fcm(Condition cond, PRegister Pd, SIMD_RegVariant T, f(0b001100, 15, 10), rf(Zn, 5), rf(Zd, 0); } + // Shuffle active elements of vector to the right and fill with zero + void sve_compact(FloatRegister Zd, SIMD_RegVariant T, FloatRegister Zn, PRegister Pg) { + starti; + assert(T == S || T == D, "invalid size"); + f(0b00000101, 31, 24), f(T, 23, 22), f(0b100001100, 21, 13); + pgrf(Pg, 10), rf(Zn, 5), rf(Zd, 0); + } + + // SVE2 Count matching elements in vector + void sve_histcnt(FloatRegister Zd, SIMD_RegVariant T, PRegister Pg, + FloatRegister Zn, FloatRegister Zm) { + starti; + assert(T == S || T == D, "invalid size"); + f(0b01000101, 31, 24), f(T, 23, 22), f(0b1, 21), rf(Zm, 16); + f(0b110, 15, 13), pgrf(Pg, 10), rf(Zn, 5), rf(Zd, 0); + } + // SVE2 bitwise permute #define INSN(NAME, opc) \ void NAME(FloatRegister Zd, SIMD_RegVariant T, FloatRegister Zn, FloatRegister Zm) { \ diff --git a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp index b096e2bf645..d7e2f3ab6ad 100644 --- a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp @@ -1113,10 +1113,12 @@ void C2_MacroAssembler::sve_vector_narrow(FloatRegister dst, SIMD_RegVariant dst sve_uzp1(dst, S, src, tmp); break; case H: + assert_different_registers(dst, tmp); sve_uzp1(dst, S, src, tmp); sve_uzp1(dst, H, dst, tmp); break; case B: + assert_different_registers(dst, tmp); sve_uzp1(dst, S, src, tmp); sve_uzp1(dst, H, dst, tmp); sve_uzp1(dst, B, dst, tmp); @@ -1128,6 +1130,7 @@ void C2_MacroAssembler::sve_vector_narrow(FloatRegister dst, SIMD_RegVariant dst if (dst_size == H) { sve_uzp1(dst, H, src, tmp); } else { // B + assert_different_registers(dst, tmp); sve_uzp1(dst, H, src, tmp); sve_uzp1(dst, B, dst, tmp); } @@ -1311,6 +1314,154 @@ void C2_MacroAssembler::sve_ptrue_lanecnt(PRegister dst, SIMD_RegVariant size, i } } +// Pack active elements of src, under the control of mask, into the lowest-numbered elements of dst. +// Any remaining elements of dst will be filled with zero. +// Clobbers: rscratch1 +// Preserves: src, mask +void C2_MacroAssembler::sve_compress_short(FloatRegister dst, FloatRegister src, PRegister mask, + FloatRegister vtmp1, FloatRegister vtmp2, + PRegister pgtmp) { + assert(pgtmp->is_governing(), "This register has to be a governing predicate register"); + assert_different_registers(dst, src, vtmp1, vtmp2); + assert_different_registers(mask, pgtmp); + + // Example input: src = 8888 7777 6666 5555 4444 3333 2222 1111 + // mask = 0001 0000 0000 0001 0001 0000 0001 0001 + // Expected result: dst = 0000 0000 0000 8888 5555 4444 2222 1111 + sve_dup(vtmp2, H, 0); + + // Extend lowest half to type INT. + // dst = 00004444 00003333 00002222 00001111 + sve_uunpklo(dst, S, src); + // pgtmp = 00000001 00000000 00000001 00000001 + sve_punpklo(pgtmp, mask); + // Pack the active elements in size of type INT to the right, + // and fill the remainings with zero. + // dst = 00000000 00004444 00002222 00001111 + sve_compact(dst, S, dst, pgtmp); + // Narrow the result back to type SHORT. + // dst = 0000 0000 0000 0000 0000 4444 2222 1111 + sve_uzp1(dst, H, dst, vtmp2); + // Count the active elements of lowest half. + // rscratch1 = 3 + sve_cntp(rscratch1, S, ptrue, pgtmp); + + // Repeat to the highest half. + // pgtmp = 00000001 00000000 00000000 00000001 + sve_punpkhi(pgtmp, mask); + // vtmp1 = 00008888 00007777 00006666 00005555 + sve_uunpkhi(vtmp1, S, src); + // vtmp1 = 00000000 00000000 00008888 00005555 + sve_compact(vtmp1, S, vtmp1, pgtmp); + // vtmp1 = 0000 0000 0000 0000 0000 0000 8888 5555 + sve_uzp1(vtmp1, H, vtmp1, vtmp2); + + // Compressed low: dst = 0000 0000 0000 0000 0000 4444 2222 1111 + // Compressed high: vtmp1 = 0000 0000 0000 0000 0000 0000 8888 5555 + // Left shift(cross lane) compressed high with TRUE_CNT lanes, + // TRUE_CNT is the number of active elements in the compressed low. + neg(rscratch1, rscratch1); + // vtmp2 = {4 3 2 1 0 -1 -2 -3} + sve_index(vtmp2, H, rscratch1, 1); + // vtmp1 = 0000 0000 0000 8888 5555 0000 0000 0000 + sve_tbl(vtmp1, H, vtmp1, vtmp2); + + // Combine the compressed high(after shifted) with the compressed low. + // dst = 0000 0000 0000 8888 5555 4444 2222 1111 + sve_orr(dst, dst, vtmp1); +} + +// Clobbers: rscratch1, rscratch2 +// Preserves: src, mask +void C2_MacroAssembler::sve_compress_byte(FloatRegister dst, FloatRegister src, PRegister mask, + FloatRegister vtmp1, FloatRegister vtmp2, + FloatRegister vtmp3, FloatRegister vtmp4, + PRegister ptmp, PRegister pgtmp) { + assert(pgtmp->is_governing(), "This register has to be a governing predicate register"); + assert_different_registers(dst, src, vtmp1, vtmp2, vtmp3, vtmp4); + assert_different_registers(mask, ptmp, pgtmp); + // Example input: src = 88 77 66 55 44 33 22 11 + // mask = 01 00 00 01 01 00 01 01 + // Expected result: dst = 00 00 00 88 55 44 22 11 + + sve_dup(vtmp4, B, 0); + // Extend lowest half to type SHORT. + // vtmp1 = 0044 0033 0022 0011 + sve_uunpklo(vtmp1, H, src); + // ptmp = 0001 0000 0001 0001 + sve_punpklo(ptmp, mask); + // Count the active elements of lowest half. + // rscratch2 = 3 + sve_cntp(rscratch2, H, ptrue, ptmp); + // Pack the active elements in size of type SHORT to the right, + // and fill the remainings with zero. + // dst = 0000 0044 0022 0011 + sve_compress_short(dst, vtmp1, ptmp, vtmp2, vtmp3, pgtmp); + // Narrow the result back to type BYTE. + // dst = 00 00 00 00 00 44 22 11 + sve_uzp1(dst, B, dst, vtmp4); + + // Repeat to the highest half. + // ptmp = 0001 0000 0000 0001 + sve_punpkhi(ptmp, mask); + // vtmp1 = 0088 0077 0066 0055 + sve_uunpkhi(vtmp2, H, src); + // vtmp1 = 0000 0000 0088 0055 + sve_compress_short(vtmp1, vtmp2, ptmp, vtmp3, vtmp4, pgtmp); + + sve_dup(vtmp4, B, 0); + // vtmp1 = 00 00 00 00 00 00 88 55 + sve_uzp1(vtmp1, B, vtmp1, vtmp4); + + // Compressed low: dst = 00 00 00 00 00 44 22 11 + // Compressed high: vtmp1 = 00 00 00 00 00 00 88 55 + // Left shift(cross lane) compressed high with TRUE_CNT lanes, + // TRUE_CNT is the number of active elements in the compressed low. + neg(rscratch2, rscratch2); + // vtmp2 = {4 3 2 1 0 -1 -2 -3} + sve_index(vtmp2, B, rscratch2, 1); + // vtmp1 = 00 00 00 88 55 00 00 00 + sve_tbl(vtmp1, B, vtmp1, vtmp2); + // Combine the compressed high(after shifted) with the compressed low. + // dst = 00 00 00 88 55 44 22 11 + sve_orr(dst, dst, vtmp1); +} + +void C2_MacroAssembler::neon_reverse_bits(FloatRegister dst, FloatRegister src, BasicType bt, bool isQ) { + assert(bt == T_BYTE || bt == T_SHORT || bt == T_INT || bt == T_LONG, "unsupported basic type"); + SIMD_Arrangement size = isQ ? T16B : T8B; + if (bt == T_BYTE) { + rbit(dst, size, src); + } else { + neon_reverse_bytes(dst, src, bt, isQ); + rbit(dst, size, dst); + } +} + +void C2_MacroAssembler::neon_reverse_bytes(FloatRegister dst, FloatRegister src, BasicType bt, bool isQ) { + assert(bt == T_BYTE || bt == T_SHORT || bt == T_INT || bt == T_LONG, "unsupported basic type"); + SIMD_Arrangement size = isQ ? T16B : T8B; + switch (bt) { + case T_BYTE: + if (dst != src) { + orr(dst, size, src, src); + } + break; + case T_SHORT: + rev16(dst, size, src); + break; + case T_INT: + rev32(dst, size, src); + break; + case T_LONG: + rev64(dst, size, src); + break; + default: + assert(false, "unsupported"); + ShouldNotReachHere(); + } +} + // Extract a scalar element from an sve vector at position 'idx'. // The input elements in src are expected to be of integral type. void C2_MacroAssembler::sve_extract_integral(Register dst, SIMD_RegVariant size, FloatRegister src, int idx, diff --git a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.hpp index 2673cc0e83b..124fa5dc296 100644 --- a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.hpp @@ -105,4 +105,20 @@ FloatRegister tmp2, PRegister ptmp, SIMD_RegVariant T); + // Pack active elements of src, under the control of mask, into the + // lowest-numbered elements of dst. Any remaining elements of dst will + // be filled with zero. + void sve_compress_byte(FloatRegister dst, FloatRegister src, PRegister mask, + FloatRegister vtmp1, FloatRegister vtmp2, + FloatRegister vtmp3, FloatRegister vtmp4, + PRegister ptmp, PRegister pgtmp); + + void sve_compress_short(FloatRegister dst, FloatRegister src, PRegister mask, + FloatRegister vtmp1, FloatRegister vtmp2, + PRegister pgtmp); + + void neon_reverse_bits(FloatRegister dst, FloatRegister src, BasicType bt, bool isQ); + + void neon_reverse_bytes(FloatRegister dst, FloatRegister src, BasicType bt, bool isQ); + #endif // CPU_AARCH64_C2_MACROASSEMBLER_AARCH64_HPP diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index 9b4da0f6145..05683de9114 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -4838,18 +4838,54 @@ void Assembler::popcntl(Register dst, Register src) { emit_int24(0x0F, (unsigned char)0xB8, (0xC0 | encode)); } -void Assembler::vpopcntd(XMMRegister dst, XMMRegister src, int vector_len) { - assert(VM_Version::supports_avx512_vpopcntdq(), "must support vpopcntdq feature"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); +void Assembler::evpopcntb(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_avx512_bitalg(), "must support avx512bitalg feature"); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_embedded_opmask_register_specifier(mask); attributes.set_is_evex_instruction(); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16(0x54, (0xC0 | encode)); +} + +void Assembler::evpopcntw(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_avx512_bitalg(), "must support avx512bitalg feature"); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16(0x54, (0xC0 | encode)); +} + +void Assembler::evpopcntd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_avx512_vpopcntdq(), "must support vpopcntdq feature"); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int16(0x55, (0xC0 | encode)); } -void Assembler::vpopcntq(XMMRegister dst, XMMRegister src, int vector_len) { +void Assembler::evpopcntq(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { assert(VM_Version::supports_avx512_vpopcntdq(), "must support vpopcntdq feature"); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int16(0x55, (0xC0 | encode)); } @@ -7894,6 +7930,32 @@ void Assembler::evprorvq(XMMRegister dst, XMMRegister src, XMMRegister shift, in emit_int16(0x14, (unsigned char)(0xC0 | encode)); } +void Assembler::evplzcntd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_avx512cd(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false,/* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16(0x44, (0xC0 | encode)); +} + +void Assembler::evplzcntq(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_avx512cd(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true,/* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16(0x44, (0xC0 | encode)); +} + void Assembler::vpternlogd(XMMRegister dst, int imm8, XMMRegister src2, XMMRegister src3, int vector_len) { assert(VM_Version::supports_evex(), "requires EVEX support"); assert(vector_len == Assembler::AVX_512bit || VM_Version::supports_avx512vl(), "requires VL support"); @@ -7930,6 +7992,84 @@ void Assembler::vpternlogq(XMMRegister dst, int imm8, XMMRegister src2, XMMRegis emit_int8(imm8); } +void Assembler::evexpandps(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_evex(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x88, (0xC0 | encode)); +} + +void Assembler::evexpandpd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_evex(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x88, (0xC0 | encode)); +} + +void Assembler::evpexpandb(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_avx512_vbmi2(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16(0x62, (0xC0 | encode)); +} + +void Assembler::evpexpandw(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_avx512_vbmi2(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16(0x62, (0xC0 | encode)); +} + +void Assembler::evpexpandd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_evex(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x89, (0xC0 | encode)); +} + +void Assembler::evpexpandq(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_evex(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); + attributes.set_is_evex_instruction(); + attributes.set_embedded_opmask_register_specifier(mask); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x89, (0xC0 | encode)); +} + // vinserti forms void Assembler::vinserti128(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) { @@ -7973,7 +8113,7 @@ void Assembler::vinserti32x4(XMMRegister dst, XMMRegister nds, XMMRegister src, } void Assembler::vinserti32x4(XMMRegister dst, XMMRegister nds, Address src, uint8_t imm8) { - assert(VM_Version::supports_avx(), ""); + assert(VM_Version::supports_evex(), ""); assert(dst != xnoreg, "sanity"); assert(imm8 <= 0x03, "imm8: %u", imm8); InstructionMark im(this); @@ -8032,7 +8172,7 @@ void Assembler::vinsertf128(XMMRegister dst, XMMRegister nds, Address src, uint8 } void Assembler::vinsertf32x4(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) { - assert(VM_Version::supports_avx2(), ""); + assert(VM_Version::supports_evex(), ""); assert(imm8 <= 0x03, "imm8: %u", imm8); InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); @@ -8045,7 +8185,7 @@ void Assembler::vinsertf32x4(XMMRegister dst, XMMRegister nds, XMMRegister src, } void Assembler::vinsertf32x4(XMMRegister dst, XMMRegister nds, Address src, uint8_t imm8) { - assert(VM_Version::supports_avx(), ""); + assert(VM_Version::supports_evex(), ""); assert(dst != xnoreg, "sanity"); assert(imm8 <= 0x03, "imm8: %u", imm8); InstructionMark im(this); @@ -8346,6 +8486,20 @@ void Assembler::vpsadbw(XMMRegister dst, XMMRegister nds, XMMRegister src, int v emit_int16((unsigned char)0xF6, (0xC0 | encode)); } +void Assembler::vpunpckhwd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { + assert(UseAVX > 0, "requires some form of AVX"); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int16(0x69, (0xC0 | encode)); +} + +void Assembler::vpunpcklwd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { + assert(UseAVX > 0, "requires some form of AVX"); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int16(0x61, (0xC0 | encode)); +} + void Assembler::vpunpckhdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); @@ -9862,6 +10016,14 @@ void Assembler::evpternlogq(XMMRegister dst, int imm8, KRegister mask, XMMRegist emit_int8(imm8); } +void Assembler::vgf2p8affineqb(XMMRegister dst, XMMRegister src2, XMMRegister src3, int imm8, int vector_len) { + assert(VM_Version::supports_gfni(), "requires GFNI support"); + assert(VM_Version::supports_sse(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + int encode = vex_prefix_and_encode(dst->encoding(), src2->encoding(), src3->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + emit_int24((unsigned char)0xCE, (unsigned char)(0xC0 | encode), imm8); +} + // duplicate 4-byte integer data from src into programmed locations in dest : requires AVX512VL void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src, int vector_len) { assert(UseAVX >= 2, ""); @@ -11555,6 +11717,85 @@ void Assembler::evpmovm2b(XMMRegister dst, KRegister src, int vector_len) { int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F_38, &attributes); emit_int16(0x28, (0xC0 | encode)); } + +void Assembler::evpcompressb(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_avx512_vbmi2(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x63, (0xC0 | encode)); +} + +void Assembler::evpcompressw(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_avx512_vbmi2(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x63, (0xC0 | encode)); +} + +void Assembler::evpcompressd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_evex(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x8B, (0xC0 | encode)); +} + +void Assembler::evpcompressq(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_evex(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x8B, (0xC0 | encode)); +} + +void Assembler::evcompressps(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_evex(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x8A, (0xC0 | encode)); +} + +void Assembler::evcompresspd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_evex(), ""); + assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + if (merge) { + attributes.reset_is_clear_context(); + } + int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0x8A, (0xC0 | encode)); +} + #ifndef _LP64 void Assembler::incl(Register dst) { diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp index 0630cdbe65a..39adcf94431 100644 --- a/src/hotspot/cpu/x86/assembler_x86.hpp +++ b/src/hotspot/cpu/x86/assembler_x86.hpp @@ -1878,8 +1878,10 @@ private: void popcntl(Register dst, Address src); void popcntl(Register dst, Register src); - void vpopcntd(XMMRegister dst, XMMRegister src, int vector_len); - void vpopcntq(XMMRegister dst, XMMRegister src, int vector_len); + void evpopcntb(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evpopcntw(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evpopcntd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evpopcntq(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); #ifdef _LP64 void popcntq(Register dst, Address src); @@ -1945,6 +1947,12 @@ private: void punpckldq(XMMRegister dst, Address src); void vpunpckldq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); + // Interleave High Word + void vpunpckhwd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); + + // Interleave Low Word + void vpunpcklwd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); + // Interleave High Doublewords void vpunpckhdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); @@ -2206,9 +2214,8 @@ private: void shrxq(Register dst, Register src1, Register src2); void bzhiq(Register dst, Register src1, Register src2); - void pdep(Register dst, Register src1, Register src2); void pext(Register dst, Register src1, Register src2); - + void pdep(Register dst, Register src1, Register src2); //====================VECTOR ARITHMETIC===================================== // Add Packed Floating-Point Values @@ -2437,6 +2444,8 @@ private: void evpternlogq(XMMRegister dst, int imm8, KRegister mask, XMMRegister src2, XMMRegister src3, bool merge, int vector_len); void evpternlogq(XMMRegister dst, int imm8, KRegister mask, XMMRegister src2, Address src3, bool merge, int vector_len); + void evplzcntd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evplzcntq(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); // Sub packed integers void psubb(XMMRegister dst, XMMRegister src); @@ -2581,6 +2590,21 @@ private: void vpternlogd(XMMRegister dst, int imm8, XMMRegister src2, Address src3, int vector_len); void vpternlogq(XMMRegister dst, int imm8, XMMRegister src2, XMMRegister src3, int vector_len); + // Vector compress/expand instructions. + void evpcompressb(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evpcompressw(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evpcompressd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evpcompressq(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evcompressps(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evcompresspd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + + void evpexpandb(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evpexpandw(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evpexpandd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evpexpandq(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evexpandps(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + void evexpandpd(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len); + // Vector Rotate Left/Right instruction. void evprolvd(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); void evprolvq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); @@ -2737,6 +2761,10 @@ private: void evpblendmw(XMMRegister dst, KRegister mask, XMMRegister nds, XMMRegister src, bool merge, int vector_len); void evpblendmd(XMMRegister dst, KRegister mask, XMMRegister nds, XMMRegister src, bool merge, int vector_len); void evpblendmq(XMMRegister dst, KRegister mask, XMMRegister nds, XMMRegister src, bool merge, int vector_len); + + // Galois field affine transformation instructions. + void vgf2p8affineqb(XMMRegister dst, XMMRegister src2, XMMRegister src3, int imm8, int vector_len); + protected: // Next instructions require address alignment 16 bytes SSE mode. // They should be called only from corresponding MacroAssembler instructions. diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index 7c5bb39c2eb..5ff729f64c1 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -2292,7 +2292,7 @@ void C2_MacroAssembler::vpadd(BasicType elem_bt, XMMRegister dst, XMMRegister sr case T_FLOAT: vaddps(dst, src1, src2, vlen_enc); return; case T_LONG: vpaddq(dst, src1, src2, vlen_enc); return; case T_DOUBLE: vaddpd(dst, src1, src2, vlen_enc); return; - default: assert(false, "%s", type2name(elem_bt)); + default: fatal("Unsupported type %s", type2name(elem_bt)); return; } } @@ -2309,7 +2309,7 @@ void C2_MacroAssembler::vpbroadcast(BasicType elem_bt, XMMRegister dst, Register case T_SHORT: evpbroadcastw(dst, src, vlen_enc); return; case T_FLOAT: case T_INT: evpbroadcastd(dst, src, vlen_enc); return; case T_DOUBLE: case T_LONG: evpbroadcastq(dst, src, vlen_enc); return; - default: assert(false, "%s", type2name(elem_bt)); + default: fatal("Unsupported type %s", type2name(elem_bt)); return; } } else { assert(vlen_enc != Assembler::AVX_512bit, "required"); @@ -2321,7 +2321,7 @@ void C2_MacroAssembler::vpbroadcast(BasicType elem_bt, XMMRegister dst, Register case T_FLOAT: movdl(dst, src); vbroadcastss(dst, dst, vlen_enc); return; case T_LONG: movdq(dst, src); vpbroadcastq(dst, dst, vlen_enc); return; case T_DOUBLE: movdq(dst, src); vbroadcastsd(dst, dst, vlen_enc); return; - default: assert(false, "%s", type2name(elem_bt)); + default: fatal("Unsupported type %s", type2name(elem_bt)); return; } } } @@ -2348,7 +2348,9 @@ void C2_MacroAssembler::vconvert_b2x(BasicType to_elem_bt, XMMRegister dst, XMMR vcvtdq2pd(dst, dst, vlen_enc); break; } - default: assert(false, "%s", type2name(to_elem_bt)); + default: + fatal("Unsupported type %s", type2name(to_elem_bt)); + break; } } @@ -4496,6 +4498,71 @@ void C2_MacroAssembler::vector_mask_operation(int opc, Register dst, XMMRegister vector_mask_operation_helper(opc, dst, tmp, masklen); } + +void C2_MacroAssembler::vector_mask_compress(KRegister dst, KRegister src, Register rtmp1, + Register rtmp2, int mask_len) { + kmov(rtmp1, src); + andq(rtmp1, (0xFFFFFFFFFFFFFFFFUL >> (64 - mask_len))); + mov64(rtmp2, -1L); + pext(rtmp2, rtmp2, rtmp1); + kmov(dst, rtmp2); +} + +void C2_MacroAssembler::vector_compress_expand(int opcode, XMMRegister dst, XMMRegister src, KRegister mask, + bool merge, BasicType bt, int vec_enc) { + if (opcode == Op_CompressV) { + switch(bt) { + case T_BYTE: + evpcompressb(dst, mask, src, merge, vec_enc); + break; + case T_CHAR: + case T_SHORT: + evpcompressw(dst, mask, src, merge, vec_enc); + break; + case T_INT: + evpcompressd(dst, mask, src, merge, vec_enc); + break; + case T_FLOAT: + evcompressps(dst, mask, src, merge, vec_enc); + break; + case T_LONG: + evpcompressq(dst, mask, src, merge, vec_enc); + break; + case T_DOUBLE: + evcompresspd(dst, mask, src, merge, vec_enc); + break; + default: + fatal("Unsupported type %s", type2name(bt)); + break; + } + } else { + assert(opcode == Op_ExpandV, ""); + switch(bt) { + case T_BYTE: + evpexpandb(dst, mask, src, merge, vec_enc); + break; + case T_CHAR: + case T_SHORT: + evpexpandw(dst, mask, src, merge, vec_enc); + break; + case T_INT: + evpexpandd(dst, mask, src, merge, vec_enc); + break; + case T_FLOAT: + evexpandps(dst, mask, src, merge, vec_enc); + break; + case T_LONG: + evpexpandq(dst, mask, src, merge, vec_enc); + break; + case T_DOUBLE: + evexpandpd(dst, mask, src, merge, vec_enc); + break; + default: + fatal("Unsupported type %s", type2name(bt)); + break; + } + } +} #endif void C2_MacroAssembler::vector_signum_evex(int opcode, XMMRegister dst, XMMRegister src, XMMRegister zero, XMMRegister one, @@ -4559,6 +4626,34 @@ void C2_MacroAssembler::vector_maskall_operation(KRegister dst, Register src, in } } +void C2_MacroAssembler::vbroadcast(BasicType bt, XMMRegister dst, int imm32, Register rtmp, int vec_enc) { + int lane_size = type2aelembytes(bt); + bool is_LP64 = LP64_ONLY(true) NOT_LP64(false); + if ((is_LP64 || lane_size < 8) && + ((is_non_subword_integral_type(bt) && VM_Version::supports_avx512vl()) || + (is_subword_type(bt) && VM_Version::supports_avx512vlbw()))) { + movptr(rtmp, imm32); + switch(lane_size) { + case 1 : evpbroadcastb(dst, rtmp, vec_enc); break; + case 2 : evpbroadcastw(dst, rtmp, vec_enc); break; + case 4 : evpbroadcastd(dst, rtmp, vec_enc); break; + case 8 : evpbroadcastq(dst, rtmp, vec_enc); break; + fatal("Unsupported lane size %d", lane_size); + break; + } + } else { + movptr(rtmp, imm32); + LP64_ONLY(movq(dst, rtmp)) NOT_LP64(movdl(dst, rtmp)); + switch(lane_size) { + case 1 : vpbroadcastb(dst, dst, vec_enc); break; + case 2 : vpbroadcastw(dst, dst, vec_enc); break; + case 4 : vpbroadcastd(dst, dst, vec_enc); break; + case 8 : vpbroadcastq(dst, dst, vec_enc); break; + fatal("Unsupported lane size %d", lane_size); + break; + } + } +} // // Following is lookup table based popcount computation algorithm:- @@ -4589,62 +4684,98 @@ void C2_MacroAssembler::vector_maskall_operation(KRegister dst, Register src, in // f. Perform step e. for upper 128bit vector lane. // g. Pack the bitset count of quadwords back to double word. // h. Unpacking and packing operations are not needed for 64bit vector lane. + +void C2_MacroAssembler::vector_popcount_byte(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc) { + assert((vec_enc == Assembler::AVX_512bit && VM_Version::supports_avx512bw()) || VM_Version::supports_avx2(), ""); + vbroadcast(T_INT, xtmp1, 0x0F0F0F0F, rtmp, vec_enc); + vpsrlw(dst, src, 4, vec_enc); + vpand(dst, dst, xtmp1, vec_enc); + vpand(xtmp1, src, xtmp1, vec_enc); + vmovdqu(xtmp2, ExternalAddress(StubRoutines::x86::vector_popcount_lut()), rtmp, vec_enc); + vpshufb(xtmp1, xtmp2, xtmp1, vec_enc); + vpshufb(dst, xtmp2, dst, vec_enc); + vpaddb(dst, dst, xtmp1, vec_enc); +} + void C2_MacroAssembler::vector_popcount_int(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, - XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, - int vec_enc) { - if (VM_Version::supports_avx512_vpopcntdq()) { - vpopcntd(dst, src, vec_enc); - } else { - assert((vec_enc == Assembler::AVX_512bit && VM_Version::supports_avx512bw()) || VM_Version::supports_avx2(), ""); - movl(rtmp, 0x0F0F0F0F); - movdl(xtmp1, rtmp); - vpbroadcastd(xtmp1, xtmp1, vec_enc); - if (Assembler::AVX_512bit == vec_enc) { - evmovdqul(xtmp2, k0, ExternalAddress(StubRoutines::x86::vector_popcount_lut()), false, vec_enc, rtmp); - } else { - vmovdqu(xtmp2, ExternalAddress(StubRoutines::x86::vector_popcount_lut()), rtmp); - } - vpand(xtmp3, src, xtmp1, vec_enc); - vpshufb(xtmp3, xtmp2, xtmp3, vec_enc); - vpsrlw(dst, src, 4, vec_enc); - vpand(dst, dst, xtmp1, vec_enc); - vpshufb(dst, xtmp2, dst, vec_enc); - vpaddb(xtmp3, dst, xtmp3, vec_enc); - vpxor(xtmp1, xtmp1, xtmp1, vec_enc); - vpunpckhdq(dst, xtmp3, xtmp1, vec_enc); - vpsadbw(dst, dst, xtmp1, vec_enc); - vpunpckldq(xtmp2, xtmp3, xtmp1, vec_enc); - vpsadbw(xtmp2, xtmp2, xtmp1, vec_enc); - vpackuswb(dst, xtmp2, dst, vec_enc); - } + XMMRegister xtmp2, Register rtmp, int vec_enc) { + vector_popcount_byte(xtmp1, src, dst, xtmp2, rtmp, vec_enc); + // Following code is as per steps e,f,g and h of above algorithm. + vpxor(xtmp2, xtmp2, xtmp2, vec_enc); + vpunpckhdq(dst, xtmp1, xtmp2, vec_enc); + vpsadbw(dst, dst, xtmp2, vec_enc); + vpunpckldq(xtmp1, xtmp1, xtmp2, vec_enc); + vpsadbw(xtmp1, xtmp1, xtmp2, vec_enc); + vpackuswb(dst, xtmp1, dst, vec_enc); +} + +void C2_MacroAssembler::vector_popcount_short(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc) { + vector_popcount_byte(xtmp1, src, dst, xtmp2, rtmp, vec_enc); + // Add the popcount of upper and lower bytes of word. + vbroadcast(T_INT, xtmp2, 0x00FF00FF, rtmp, vec_enc); + vpsrlw(dst, xtmp1, 8, vec_enc); + vpand(xtmp1, xtmp1, xtmp2, vec_enc); + vpaddw(dst, dst, xtmp1, vec_enc); } void C2_MacroAssembler::vector_popcount_long(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, - XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, - int vec_enc) { - if (VM_Version::supports_avx512_vpopcntdq()) { - vpopcntq(dst, src, vec_enc); - } else if (vec_enc == Assembler::AVX_512bit) { - assert(VM_Version::supports_avx512bw(), ""); - movl(rtmp, 0x0F0F0F0F); - movdl(xtmp1, rtmp); - vpbroadcastd(xtmp1, xtmp1, vec_enc); - evmovdqul(xtmp2, k0, ExternalAddress(StubRoutines::x86::vector_popcount_lut()), true, vec_enc, rtmp); - vpandq(xtmp3, src, xtmp1, vec_enc); - vpshufb(xtmp3, xtmp2, xtmp3, vec_enc); - vpsrlw(dst, src, 4, vec_enc); - vpandq(dst, dst, xtmp1, vec_enc); - vpshufb(dst, xtmp2, dst, vec_enc); - vpaddb(xtmp3, dst, xtmp3, vec_enc); - vpxorq(xtmp1, xtmp1, xtmp1, vec_enc); - vpsadbw(dst, xtmp3, xtmp1, vec_enc); - } else { - // We do not see any performance benefit of running - // above instruction sequence on 256 bit vector which - // can operate over maximum 4 long elements. - ShouldNotReachHere(); + XMMRegister xtmp2, Register rtmp, int vec_enc) { + vector_popcount_byte(xtmp1, src, dst, xtmp2, rtmp, vec_enc); + vpxor(xtmp2, xtmp2, xtmp2, vec_enc); + vpsadbw(dst, xtmp1, xtmp2, vec_enc); +} + +void C2_MacroAssembler::vector_popcount_integral(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc) { + switch(bt) { + case T_LONG: + vector_popcount_long(dst, src, xtmp1, xtmp2, rtmp, vec_enc); + break; + case T_INT: + vector_popcount_int(dst, src, xtmp1, xtmp2, rtmp, vec_enc); + break; + case T_CHAR: + case T_SHORT: + vector_popcount_short(dst, src, xtmp1, xtmp2, rtmp, vec_enc); + break; + case T_BYTE: + case T_BOOLEAN: + vector_popcount_byte(dst, src, xtmp1, xtmp2, rtmp, vec_enc); + break; + default: + fatal("Unsupported type %s", type2name(bt)); + break; + } +} + +void C2_MacroAssembler::vector_popcount_integral_evex(BasicType bt, XMMRegister dst, XMMRegister src, + KRegister mask, bool merge, int vec_enc) { + assert(VM_Version::supports_avx512vl() || vec_enc == Assembler::AVX_512bit, ""); + switch(bt) { + case T_LONG: + assert(VM_Version::supports_avx512_vpopcntdq(), ""); + evpopcntq(dst, mask, src, merge, vec_enc); + break; + case T_INT: + assert(VM_Version::supports_avx512_vpopcntdq(), ""); + evpopcntd(dst, mask, src, merge, vec_enc); + break; + case T_CHAR: + case T_SHORT: + assert(VM_Version::supports_avx512_bitalg(), ""); + evpopcntw(dst, mask, src, merge, vec_enc); + break; + case T_BYTE: + case T_BOOLEAN: + assert(VM_Version::supports_avx512_bitalg(), ""); + evpopcntb(dst, mask, src, merge, vec_enc); + break; + default: + fatal("Unsupported type %s", type2name(bt)); + break; } - evpmovqd(dst, dst, vec_enc); } #ifndef _LP64 @@ -4655,6 +4786,374 @@ void C2_MacroAssembler::vector_maskall_operation32(KRegister dst, Register src, } #endif +// Bit reversal algorithm first reverses the bits of each byte followed by +// a byte level reversal for multi-byte primitive types (short/int/long). +// Algorithm performs a lookup table access to get reverse bit sequence +// corresponding to a 4 bit value. Thus a reverse bit sequence for a byte +// is obtained by swapping the reverse bit sequences of upper and lower +// nibble of a byte. +void C2_MacroAssembler::vector_reverse_bit(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc) { + if (VM_Version::supports_avx512vlbw()) { + + // Get the reverse bit sequence of lower nibble of each byte. + vmovdqu(xtmp1, ExternalAddress(StubRoutines::x86::vector_reverse_bit_lut()), rtmp, vec_enc); + vbroadcast(T_INT, xtmp2, 0x0F0F0F0F, rtmp, vec_enc); + vpandq(dst, xtmp2, src, vec_enc); + vpshufb(dst, xtmp1, dst, vec_enc); + vpsllq(dst, dst, 4, vec_enc); + + // Get the reverse bit sequence of upper nibble of each byte. + vpandn(xtmp2, xtmp2, src, vec_enc); + vpsrlq(xtmp2, xtmp2, 4, vec_enc); + vpshufb(xtmp2, xtmp1, xtmp2, vec_enc); + + // Perform logical OR operation b/w left shifted reverse bit sequence of lower nibble and + // right shifted reverse bit sequence of upper nibble to obtain the reverse bit sequence of each byte. + vporq(xtmp2, dst, xtmp2, vec_enc); + vector_reverse_byte(bt, dst, xtmp2, rtmp, vec_enc); + + } else if(vec_enc == Assembler::AVX_512bit) { + // Shift based bit reversal. + assert(bt == T_LONG || bt == T_INT, ""); + + // Swap lower and upper nibble of each byte. + vector_swap_nbits(4, 0x0F0F0F0F, xtmp1, src, xtmp2, rtmp, vec_enc); + + // Swap two least and most significant bits of each nibble. + vector_swap_nbits(2, 0x33333333, dst, xtmp1, xtmp2, rtmp, vec_enc); + + // Swap adjacent pair of bits. + evmovdqul(xtmp1, k0, dst, true, vec_enc); + vector_swap_nbits(1, 0x55555555, dst, xtmp1, xtmp2, rtmp, vec_enc); + + evmovdqul(xtmp1, k0, dst, true, vec_enc); + vector_reverse_byte64(bt, dst, xtmp1, xtmp1, xtmp2, rtmp, vec_enc); + } else { + vmovdqu(xtmp1, ExternalAddress(StubRoutines::x86::vector_reverse_bit_lut()), rtmp, vec_enc); + vbroadcast(T_INT, xtmp2, 0x0F0F0F0F, rtmp, vec_enc); + + // Get the reverse bit sequence of lower nibble of each byte. + vpand(dst, xtmp2, src, vec_enc); + vpshufb(dst, xtmp1, dst, vec_enc); + vpsllq(dst, dst, 4, vec_enc); + + // Get the reverse bit sequence of upper nibble of each byte. + vpandn(xtmp2, xtmp2, src, vec_enc); + vpsrlq(xtmp2, xtmp2, 4, vec_enc); + vpshufb(xtmp2, xtmp1, xtmp2, vec_enc); + + // Perform logical OR operation b/w left shifted reverse bit sequence of lower nibble and + // right shifted reverse bit sequence of upper nibble to obtain the reverse bit sequence of each byte. + vpor(xtmp2, dst, xtmp2, vec_enc); + vector_reverse_byte(bt, dst, xtmp2, rtmp, vec_enc); + } +} + +void C2_MacroAssembler::vector_reverse_bit_gfni(BasicType bt, XMMRegister dst, XMMRegister src, + XMMRegister xtmp, AddressLiteral mask, Register rtmp, int vec_enc) { + // Galois field instruction based bit reversal based on following algorithm. + // http://0x80.pl/articles/avx512-galois-field-for-bit-shuffling.html + assert(VM_Version::supports_gfni(), ""); + vpbroadcastq(xtmp, mask, vec_enc, rtmp); + vgf2p8affineqb(xtmp, src, xtmp, 0, vec_enc); + vector_reverse_byte(bt, dst, xtmp, rtmp, vec_enc); +} + +void C2_MacroAssembler::vector_swap_nbits(int nbits, int bitmask, XMMRegister dst, XMMRegister src, + XMMRegister xtmp1, Register rtmp, int vec_enc) { + vbroadcast(T_INT, xtmp1, bitmask, rtmp, vec_enc); + vpandq(dst, xtmp1, src, vec_enc); + vpsllq(dst, dst, nbits, vec_enc); + vpandn(xtmp1, xtmp1, src, vec_enc); + vpsrlq(xtmp1, xtmp1, nbits, vec_enc); + vporq(dst, dst, xtmp1, vec_enc); +} + +void C2_MacroAssembler::vector_reverse_byte64(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc) { + // Shift based bit reversal. + assert(VM_Version::supports_evex(), ""); + switch(bt) { + case T_LONG: + // Swap upper and lower double word of each quad word. + evprorq(xtmp1, k0, src, 32, true, vec_enc); + evprord(xtmp1, k0, xtmp1, 16, true, vec_enc); + vector_swap_nbits(8, 0x00FF00FF, dst, xtmp1, xtmp2, rtmp, vec_enc); + break; + case T_INT: + // Swap upper and lower word of each double word. + evprord(xtmp1, k0, src, 16, true, vec_enc); + vector_swap_nbits(8, 0x00FF00FF, dst, xtmp1, xtmp2, rtmp, vec_enc); + break; + case T_SHORT: + // Swap upper and lower byte of each word. + vector_swap_nbits(8, 0x00FF00FF, dst, src, xtmp2, rtmp, vec_enc); + break; + case T_BYTE: + evmovdquq(dst, k0, src, true, vec_enc); + break; + default: + fatal("Unsupported type %s", type2name(bt)); + break; + } +} + +void C2_MacroAssembler::vector_reverse_byte(BasicType bt, XMMRegister dst, XMMRegister src, Register rtmp, int vec_enc) { + if (bt == T_BYTE) { + if (VM_Version::supports_avx512vl() || vec_enc == Assembler::AVX_512bit) { + evmovdquq(dst, k0, src, true, vec_enc); + } else { + vmovdqu(dst, src); + } + return; + } + // Perform byte reversal by shuffling the bytes of a multi-byte primitive type using + // pre-computed shuffle indices. + switch(bt) { + case T_LONG: + vmovdqu(dst, ExternalAddress(StubRoutines::x86::vector_reverse_byte_perm_mask_long()), rtmp, vec_enc); + break; + case T_INT: + vmovdqu(dst, ExternalAddress(StubRoutines::x86::vector_reverse_byte_perm_mask_int()), rtmp, vec_enc); + break; + case T_SHORT: + vmovdqu(dst, ExternalAddress(StubRoutines::x86::vector_reverse_byte_perm_mask_short()), rtmp, vec_enc); + break; + default: + fatal("Unsupported type %s", type2name(bt)); + break; + } + vpshufb(dst, src, dst, vec_enc); +} + +void C2_MacroAssembler::vector_count_leading_zeros_evex(BasicType bt, XMMRegister dst, XMMRegister src, + XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, + KRegister ktmp, Register rtmp, bool merge, int vec_enc) { + assert(is_integral_type(bt), ""); + assert(VM_Version::supports_avx512vl() || vec_enc == Assembler::AVX_512bit, ""); + assert(VM_Version::supports_avx512cd(), ""); + switch(bt) { + case T_LONG: + evplzcntq(dst, ktmp, src, merge, vec_enc); + break; + case T_INT: + evplzcntd(dst, ktmp, src, merge, vec_enc); + break; + case T_SHORT: + vpternlogd(xtmp1, 0xff, xtmp1, xtmp1, vec_enc); + vpunpcklwd(xtmp2, xtmp1, src, vec_enc); + evplzcntd(xtmp2, ktmp, xtmp2, merge, vec_enc); + vpunpckhwd(dst, xtmp1, src, vec_enc); + evplzcntd(dst, ktmp, dst, merge, vec_enc); + vpackusdw(dst, xtmp2, dst, vec_enc); + break; + case T_BYTE: + // T1 = Compute leading zero counts of 4 LSB bits of each byte by + // accessing the lookup table. + // T2 = Compute leading zero counts of 4 MSB bits of each byte by + // accessing the lookup table. + // Add T1 to T2 if 4 MSB bits of byte are all zeros. + assert(VM_Version::supports_avx512bw(), ""); + evmovdquq(xtmp1, ExternalAddress(StubRoutines::x86::vector_count_leading_zeros_lut()), vec_enc, rtmp); + vbroadcast(T_INT, dst, 0x0F0F0F0F, rtmp, vec_enc); + vpand(xtmp2, dst, src, vec_enc); + vpshufb(xtmp2, xtmp1, xtmp2, vec_enc); + vpsrlw(xtmp3, src, 4, vec_enc); + vpand(xtmp3, dst, xtmp3, vec_enc); + vpshufb(dst, xtmp1, xtmp3, vec_enc); + vpxor(xtmp1, xtmp1, xtmp1, vec_enc); + evpcmpeqb(ktmp, xtmp1, xtmp3, vec_enc); + evpaddb(dst, ktmp, dst, xtmp2, true, vec_enc); + break; + default: + fatal("Unsupported type %s", type2name(bt)); + break; + } +} + +void C2_MacroAssembler::vector_count_leading_zeros_byte_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc) { + vmovdqu(xtmp1, ExternalAddress(StubRoutines::x86::vector_count_leading_zeros_lut()), rtmp); + vbroadcast(T_INT, xtmp2, 0x0F0F0F0F, rtmp, vec_enc); + // T1 = Compute leading zero counts of 4 LSB bits of each byte by + // accessing the lookup table. + vpand(dst, xtmp2, src, vec_enc); + vpshufb(dst, xtmp1, dst, vec_enc); + // T2 = Compute leading zero counts of 4 MSB bits of each byte by + // accessing the lookup table. + vpsrlw(xtmp3, src, 4, vec_enc); + vpand(xtmp3, xtmp2, xtmp3, vec_enc); + vpshufb(xtmp2, xtmp1, xtmp3, vec_enc); + // Add T1 to T2 if 4 MSB bits of byte are all zeros. + vpxor(xtmp1, xtmp1, xtmp1, vec_enc); + vpcmpeqb(xtmp3, xtmp1, xtmp3, vec_enc); + vpaddb(dst, dst, xtmp2, vec_enc); + vpblendvb(dst, xtmp2, dst, xtmp3, vec_enc); +} + +void C2_MacroAssembler::vector_count_leading_zeros_short_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc) { + vector_count_leading_zeros_byte_avx(dst, src, xtmp1, xtmp2, xtmp3, rtmp, vec_enc); + // Add zero counts of lower byte and upper byte of a word if + // upper byte holds a zero value. + vpsrlw(xtmp3, src, 8, vec_enc); + // xtmp1 is set to all zeros by vector_count_leading_zeros_byte_avx. + vpcmpeqw(xtmp3, xtmp1, xtmp3, vec_enc); + vpsllw(xtmp2, dst, 8, vec_enc); + vpaddw(xtmp2, xtmp2, dst, vec_enc); + vpblendvb(dst, dst, xtmp2, xtmp3, vec_enc); + vpsrlw(dst, dst, 8, vec_enc); +} + +void C2_MacroAssembler::vector_count_leading_zeros_int_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, int vec_enc) { + // Since IEEE 754 floating point format represents mantissa in 1.0 format + // hence biased exponent can be used to compute leading zero count as per + // following formula:- + // LZCNT = 32 - (biased_exp - 127) + // Special handling has been introduced for Zero, Max_Int and -ve source values. + + // Broadcast 0xFF + vpcmpeqd(xtmp1, xtmp1, xtmp1, vec_enc); + vpsrld(xtmp1, xtmp1, 24, vec_enc); + + // Extract biased exponent. + vcvtdq2ps(dst, src, vec_enc); + vpsrld(dst, dst, 23, vec_enc); + vpand(dst, dst, xtmp1, vec_enc); + + // Broadcast 127. + vpsrld(xtmp1, xtmp1, 1, vec_enc); + // Exponent = biased_exp - 127 + vpsubd(dst, dst, xtmp1, vec_enc); + + // Exponent = Exponent + 1 + vpsrld(xtmp3, xtmp1, 6, vec_enc); + vpaddd(dst, dst, xtmp3, vec_enc); + + // Replace -ve exponent with zero, exponent is -ve when src + // lane contains a zero value. + vpxor(xtmp2, xtmp2, xtmp2, vec_enc); + vblendvps(dst, dst, xtmp2, dst, vec_enc); + + // Rematerialize broadcast 32. + vpslld(xtmp1, xtmp3, 5, vec_enc); + // Exponent is 32 if corresponding source lane contains max_int value. + vpcmpeqd(xtmp2, dst, xtmp1, vec_enc); + // LZCNT = 32 - exponent + vpsubd(dst, xtmp1, dst, vec_enc); + + // Replace LZCNT with a value 1 if corresponding source lane + // contains max_int value. + vpblendvb(dst, dst, xtmp3, xtmp2, vec_enc); + + // Replace biased_exp with 0 if source lane value is less than zero. + vpxor(xtmp2, xtmp2, xtmp2, vec_enc); + vblendvps(dst, dst, xtmp2, src, vec_enc); +} + +void C2_MacroAssembler::vector_count_leading_zeros_long_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc) { + vector_count_leading_zeros_short_avx(dst, src, xtmp1, xtmp2, xtmp3, rtmp, vec_enc); + // Add zero counts of lower word and upper word of a double word if + // upper word holds a zero value. + vpsrld(xtmp3, src, 16, vec_enc); + // xtmp1 is set to all zeros by vector_count_leading_zeros_byte_avx. + vpcmpeqd(xtmp3, xtmp1, xtmp3, vec_enc); + vpslld(xtmp2, dst, 16, vec_enc); + vpaddd(xtmp2, xtmp2, dst, vec_enc); + vpblendvb(dst, dst, xtmp2, xtmp3, vec_enc); + vpsrld(dst, dst, 16, vec_enc); + // Add zero counts of lower doubleword and upper doubleword of a + // quadword if upper doubleword holds a zero value. + vpsrlq(xtmp3, src, 32, vec_enc); + vpcmpeqq(xtmp3, xtmp1, xtmp3, vec_enc); + vpsllq(xtmp2, dst, 32, vec_enc); + vpaddq(xtmp2, xtmp2, dst, vec_enc); + vpblendvb(dst, dst, xtmp2, xtmp3, vec_enc); + vpsrlq(dst, dst, 32, vec_enc); +} + +void C2_MacroAssembler::vector_count_leading_zeros_avx(BasicType bt, XMMRegister dst, XMMRegister src, + XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, + Register rtmp, int vec_enc) { + assert(is_integral_type(bt), "unexpected type"); + assert(vec_enc < Assembler::AVX_512bit, ""); + switch(bt) { + case T_LONG: + vector_count_leading_zeros_long_avx(dst, src, xtmp1, xtmp2, xtmp3, rtmp, vec_enc); + break; + case T_INT: + vector_count_leading_zeros_int_avx(dst, src, xtmp1, xtmp2, xtmp3, vec_enc); + break; + case T_SHORT: + vector_count_leading_zeros_short_avx(dst, src, xtmp1, xtmp2, xtmp3, rtmp, vec_enc); + break; + case T_BYTE: + vector_count_leading_zeros_byte_avx(dst, src, xtmp1, xtmp2, xtmp3, rtmp, vec_enc); + break; + default: + fatal("Unsupported type %s", type2name(bt)); + break; + } +} + +void C2_MacroAssembler::vpsub(BasicType bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vec_enc) { + switch(bt) { + case T_BYTE: + vpsubb(dst, src1, src2, vec_enc); + break; + case T_SHORT: + vpsubw(dst, src1, src2, vec_enc); + break; + case T_INT: + vpsubd(dst, src1, src2, vec_enc); + break; + case T_LONG: + vpsubq(dst, src1, src2, vec_enc); + break; + default: + fatal("Unsupported type %s", type2name(bt)); + break; + } +} + +// Trailing zero count computation is based on leading zero count operation as per +// following equation. All AVX3 targets support AVX512CD feature which offers +// direct vector instruction to compute leading zero count. +// CTZ = PRIM_TYPE_WIDHT - CLZ((x - 1) & ~x) +void C2_MacroAssembler::vector_count_trailing_zeros_evex(BasicType bt, XMMRegister dst, XMMRegister src, + XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, + XMMRegister xtmp4, KRegister ktmp, Register rtmp, int vec_enc) { + assert(is_integral_type(bt), ""); + // xtmp = -1 + vpternlogd(xtmp4, 0xff, xtmp4, xtmp4, vec_enc); + // xtmp = xtmp + src + vpadd(bt, xtmp4, xtmp4, src, vec_enc); + // xtmp = xtmp & ~src + vpternlogd(xtmp4, 0x40, xtmp4, src, vec_enc); + vector_count_leading_zeros_evex(bt, dst, xtmp4, xtmp1, xtmp2, xtmp3, ktmp, rtmp, true, vec_enc); + vbroadcast(bt, xtmp4, 8 * type2aelembytes(bt), rtmp, vec_enc); + vpsub(bt, dst, xtmp4, dst, vec_enc); +} + +// Trailing zero count computation for AVX2 targets is based on popcount operation as per following equation +// CTZ = PRIM_TYPE_WIDHT - POPC(x | -x) +void C2_MacroAssembler::vector_count_trailing_zeros_avx(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc) { + assert(is_integral_type(bt), ""); + // xtmp = 0 + vpxor(xtmp3 , xtmp3, xtmp3, vec_enc); + // xtmp = 0 - src + vpsub(bt, xtmp3, xtmp3, src, vec_enc); + // xtmp = xtmp | src + vpor(xtmp3, xtmp3, src, vec_enc); + vector_popcount_integral(bt, dst, xtmp3, xtmp1, xtmp2, rtmp, vec_enc); + vbroadcast(bt, xtmp1, 8 * type2aelembytes(bt), rtmp, vec_enc); + vpsub(bt, dst, xtmp1, dst, vec_enc); +} + void C2_MacroAssembler::udivI(Register rax, Register divisor, Register rdx) { Label done; Label neg_divisor_fastpath; @@ -4817,4 +5316,3 @@ void C2_MacroAssembler::udivmodL(Register rax, Register divisor, Register rdx, R bind(done); } #endif - diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp index bde78a6966b..6d60a300b38 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp @@ -88,6 +88,11 @@ public: XMMRegister zero, XMMRegister one, Register scratch); + void vector_compress_expand(int opcode, XMMRegister dst, XMMRegister src, KRegister mask, + bool merge, BasicType bt, int vec_enc); + + void vector_mask_compress(KRegister dst, KRegister src, Register rtmp1, Register rtmp2, int mask_len); + void vextendbw(bool sign, XMMRegister dst, XMMRegister src, int vector_len); void vextendbw(bool sign, XMMRegister dst, XMMRegister src); void vextendbd(bool sign, XMMRegister dst, XMMRegister src, int vector_len); @@ -137,7 +142,6 @@ public: #ifdef _LP64 void vpbroadcast(BasicType elem_bt, XMMRegister dst, Register src, int vlen_enc); #endif - void vpadd(BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vlen_enc); // blend void evpcmp(BasicType typ, KRegister kdmask, KRegister ksmask, XMMRegister src1, AddressLiteral adr, int comparison, int vector_len, Register scratch = rscratch1); @@ -341,34 +345,89 @@ public: AddressLiteral new_mxcsr, Register scratch, int vec_enc); #endif + void udivI(Register rax, Register divisor, Register rdx); + void umodI(Register rax, Register divisor, Register rdx); + void udivmodI(Register rax, Register divisor, Register rdx, Register tmp); + +#ifdef _LP64 + void udivL(Register rax, Register divisor, Register rdx); + void umodL(Register rax, Register divisor, Register rdx); + void udivmodL(Register rax, Register divisor, Register rdx, Register tmp); +#endif + void evpternlog(XMMRegister dst, int func, KRegister mask, XMMRegister src2, XMMRegister src3, bool merge, BasicType bt, int vlen_enc); void evpternlog(XMMRegister dst, int func, KRegister mask, XMMRegister src2, Address src3, bool merge, BasicType bt, int vlen_enc); + void vector_reverse_bit(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc); + + void vector_reverse_bit_gfni(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp, + AddressLiteral mask, Register rtmp, int vec_enc); + + void vector_reverse_byte(BasicType bt, XMMRegister dst, XMMRegister src, Register rtmp, int vec_enc); + + void vector_popcount_int(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc); + + void vector_popcount_long(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc); + + void vector_popcount_short(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc); + + void vector_popcount_byte(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc); + + void vector_popcount_integral(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc); + + void vector_popcount_integral_evex(BasicType bt, XMMRegister dst, XMMRegister src, + KRegister mask, bool merge, int vec_enc); + + void vbroadcast(BasicType bt, XMMRegister dst, int imm32, Register rtmp, int vec_enc); + + void vector_reverse_byte64(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, Register rtmp, int vec_enc); + + void vector_count_leading_zeros_evex(BasicType bt, XMMRegister dst, XMMRegister src, + XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, + KRegister ktmp, Register rtmp, bool merge, int vec_enc); + + void vector_count_leading_zeros_byte_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); + + void vector_count_leading_zeros_short_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); + + void vector_count_leading_zeros_int_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, int vec_enc); + + void vector_count_leading_zeros_long_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); + + void vector_count_leading_zeros_avx(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); + + void vpadd(BasicType bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vec_enc); + + void vpsub(BasicType bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vec_enc); + + void vector_count_trailing_zeros_evex(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, XMMRegister xtmp4, KRegister ktmp, + Register rtmp, int vec_enc); + + void vector_swap_nbits(int nbits, int bitmask, XMMRegister dst, XMMRegister src, + XMMRegister xtmp1, Register rtmp, int vec_enc); + + void vector_count_trailing_zeros_avx(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); + void vector_signum_avx(int opcode, XMMRegister dst, XMMRegister src, XMMRegister zero, XMMRegister one, XMMRegister xtmp1, int vec_enc); void vector_signum_evex(int opcode, XMMRegister dst, XMMRegister src, XMMRegister zero, XMMRegister one, KRegister ktmp1, int vec_enc); - - void udivI(Register rax, Register divisor, Register rdx); - void umodI(Register rax, Register divisor, Register rdx); - void udivmodI(Register rax, Register divisor, Register rdx, Register tmp); - - #ifdef _LP64 - void udivL(Register rax, Register divisor, Register rdx); - void umodL(Register rax, Register divisor, Register rdx); - void udivmodL(Register rax, Register divisor, Register rdx, Register tmp); - #endif - - void vector_popcount_int(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, - XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, - int vec_enc); - - void vector_popcount_long(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, - XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, - int vec_enc); - #endif // CPU_X86_C2_MACROASSEMBLER_X86_HPP diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index ade1b816a4d..f19c6faaaf6 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -2577,8 +2577,9 @@ void MacroAssembler::vmovdqu(XMMRegister dst, AddressLiteral src, Register scrat } void MacroAssembler::vmovdqu(XMMRegister dst, AddressLiteral src, Register scratch_reg, int vector_len) { - assert(vector_len <= AVX_256bit, "AVX2 vector length"); - if (vector_len == AVX_256bit) { + if (vector_len == AVX_512bit) { + evmovdquq(dst, src, AVX_512bit, scratch_reg); + } else if (vector_len == AVX_256bit) { vmovdqu(dst, src, scratch_reg); } else { movdqu(dst, src, scratch_reg); @@ -3229,6 +3230,15 @@ void MacroAssembler::vpbroadcastw(XMMRegister dst, XMMRegister src, int vector_l Assembler::vpbroadcastw(dst, src, vector_len); } +void MacroAssembler::vpbroadcastq(XMMRegister dst, AddressLiteral src, int vector_len, Register rscratch) { + if (reachable(src)) { + Assembler::vpbroadcastq(dst, as_Address(src), vector_len); + } else { + lea(rscratch, src); + Assembler::vpbroadcastq(dst, Address(rscratch, 0), vector_len); + } +} + void MacroAssembler::vbroadcastsd(XMMRegister dst, AddressLiteral src, int vector_len, Register rscratch) { if (reachable(src)) { Assembler::vbroadcastsd(dst, as_Address(src), vector_len); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index 54d1a0c2c69..496da3088cf 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -1347,6 +1347,11 @@ public: using Assembler::vbroadcastsd; void vbroadcastsd(XMMRegister dst, AddressLiteral src, int vector_len, Register rscratch = rscratch1); + void vpbroadcastq(XMMRegister dst, AddressLiteral src, int vector_len, Register rscratch = rscratch1); + void vpbroadcastq(XMMRegister dst, XMMRegister src, int vector_len) { Assembler::vpbroadcastq(dst, src, vector_len); } + void vpbroadcastq(XMMRegister dst, Address src, int vector_len) { Assembler::vpbroadcastq(dst, src, vector_len); } + + void vpcmpeqb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); diff --git a/src/hotspot/cpu/x86/matcher_x86.hpp b/src/hotspot/cpu/x86/matcher_x86.hpp index 7a9e0f8ee08..a9cd1b37d49 100644 --- a/src/hotspot/cpu/x86/matcher_x86.hpp +++ b/src/hotspot/cpu/x86/matcher_x86.hpp @@ -186,15 +186,29 @@ // Returns pre-selection estimated size of a vector operation. static int vector_op_pre_select_sz_estimate(int vopc, BasicType ety, int vlen) { switch(vopc) { - default: return 0; - case Op_PopCountVI: return VM_Version::supports_avx512_vpopcntdq() ? 0 : 50; - case Op_PopCountVL: return VM_Version::supports_avx512_vpopcntdq() ? 0 : 40; + default: + return 0; + case Op_CountTrailingZerosV: + case Op_CountLeadingZerosV: + return VM_Version::supports_avx512cd() && (ety == T_INT || ety == T_LONG) ? 0 : 40; + case Op_PopCountVI: + if (is_subword_type(ety)) { + return VM_Version::supports_avx512_bitalg() ? 0 : 50; + } else { + assert(ety == T_INT, "sanity"); // for documentation purposes + return VM_Version::supports_avx512_vpopcntdq() ? 0 : 50; + } + case Op_PopCountVL: + return VM_Version::supports_avx512_vpopcntdq() ? 0 : 40; + case Op_ReverseV: + return VM_Version::supports_gfni() ? 0 : 30; case Op_RoundVF: // fall through case Op_RoundVD: { return 30; } } } + // Returns pre-selection estimated size of a scalar operation. static int scalar_op_pre_select_sz_estimate(int vopc, BasicType ety) { switch(vopc) { diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp index c06cc964201..b551c38fa2d 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp @@ -588,6 +588,30 @@ class StubGenerator: public StubCodeGenerator { return start; } + address generate_count_leading_zeros_lut(const char *stub_name) { + __ align64(); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data(0x02020304, relocInfo::none, 0); + __ emit_data(0x01010101, relocInfo::none, 0); + __ emit_data(0x00000000, relocInfo::none, 0); + __ emit_data(0x00000000, relocInfo::none, 0); + __ emit_data(0x02020304, relocInfo::none, 0); + __ emit_data(0x01010101, relocInfo::none, 0); + __ emit_data(0x00000000, relocInfo::none, 0); + __ emit_data(0x00000000, relocInfo::none, 0); + __ emit_data(0x02020304, relocInfo::none, 0); + __ emit_data(0x01010101, relocInfo::none, 0); + __ emit_data(0x00000000, relocInfo::none, 0); + __ emit_data(0x00000000, relocInfo::none, 0); + __ emit_data(0x02020304, relocInfo::none, 0); + __ emit_data(0x01010101, relocInfo::none, 0); + __ emit_data(0x00000000, relocInfo::none, 0); + __ emit_data(0x00000000, relocInfo::none, 0); + return start; + } + + address generate_popcount_avx_lut(const char *stub_name) { __ align64(); StubCodeMark mark(this, "StubRoutines", stub_name); @@ -635,6 +659,98 @@ class StubGenerator: public StubCodeGenerator { return start; } + address generate_vector_reverse_bit_lut(const char *stub_name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data(0x0C040800, relocInfo::none, 0); + __ emit_data(0x0E060A02, relocInfo::none, 0); + __ emit_data(0x0D050901, relocInfo::none, 0); + __ emit_data(0x0F070B03, relocInfo::none, 0); + __ emit_data(0x0C040800, relocInfo::none, 0); + __ emit_data(0x0E060A02, relocInfo::none, 0); + __ emit_data(0x0D050901, relocInfo::none, 0); + __ emit_data(0x0F070B03, relocInfo::none, 0); + __ emit_data(0x0C040800, relocInfo::none, 0); + __ emit_data(0x0E060A02, relocInfo::none, 0); + __ emit_data(0x0D050901, relocInfo::none, 0); + __ emit_data(0x0F070B03, relocInfo::none, 0); + __ emit_data(0x0C040800, relocInfo::none, 0); + __ emit_data(0x0E060A02, relocInfo::none, 0); + __ emit_data(0x0D050901, relocInfo::none, 0); + __ emit_data(0x0F070B03, relocInfo::none, 0); + return start; + } + + address generate_vector_reverse_byte_perm_mask_long(const char *stub_name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data(0x04050607, relocInfo::none, 0); + __ emit_data(0x00010203, relocInfo::none, 0); + __ emit_data(0x0C0D0E0F, relocInfo::none, 0); + __ emit_data(0x08090A0B, relocInfo::none, 0); + __ emit_data(0x04050607, relocInfo::none, 0); + __ emit_data(0x00010203, relocInfo::none, 0); + __ emit_data(0x0C0D0E0F, relocInfo::none, 0); + __ emit_data(0x08090A0B, relocInfo::none, 0); + __ emit_data(0x04050607, relocInfo::none, 0); + __ emit_data(0x00010203, relocInfo::none, 0); + __ emit_data(0x0C0D0E0F, relocInfo::none, 0); + __ emit_data(0x08090A0B, relocInfo::none, 0); + __ emit_data(0x04050607, relocInfo::none, 0); + __ emit_data(0x00010203, relocInfo::none, 0); + __ emit_data(0x0C0D0E0F, relocInfo::none, 0); + __ emit_data(0x08090A0B, relocInfo::none, 0); + return start; + } + + address generate_vector_reverse_byte_perm_mask_int(const char *stub_name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data(0x00010203, relocInfo::none, 0); + __ emit_data(0x04050607, relocInfo::none, 0); + __ emit_data(0x08090A0B, relocInfo::none, 0); + __ emit_data(0x0C0D0E0F, relocInfo::none, 0); + __ emit_data(0x00010203, relocInfo::none, 0); + __ emit_data(0x04050607, relocInfo::none, 0); + __ emit_data(0x08090A0B, relocInfo::none, 0); + __ emit_data(0x0C0D0E0F, relocInfo::none, 0); + __ emit_data(0x00010203, relocInfo::none, 0); + __ emit_data(0x04050607, relocInfo::none, 0); + __ emit_data(0x08090A0B, relocInfo::none, 0); + __ emit_data(0x0C0D0E0F, relocInfo::none, 0); + __ emit_data(0x00010203, relocInfo::none, 0); + __ emit_data(0x04050607, relocInfo::none, 0); + __ emit_data(0x08090A0B, relocInfo::none, 0); + __ emit_data(0x0C0D0E0F, relocInfo::none, 0); + return start; + } + + address generate_vector_reverse_byte_perm_mask_short(const char *stub_name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data(0x02030001, relocInfo::none, 0); + __ emit_data(0x06070405, relocInfo::none, 0); + __ emit_data(0x0A0B0809, relocInfo::none, 0); + __ emit_data(0x0E0F0C0D, relocInfo::none, 0); + __ emit_data(0x02030001, relocInfo::none, 0); + __ emit_data(0x06070405, relocInfo::none, 0); + __ emit_data(0x0A0B0809, relocInfo::none, 0); + __ emit_data(0x0E0F0C0D, relocInfo::none, 0); + __ emit_data(0x02030001, relocInfo::none, 0); + __ emit_data(0x06070405, relocInfo::none, 0); + __ emit_data(0x0A0B0809, relocInfo::none, 0); + __ emit_data(0x0E0F0C0D, relocInfo::none, 0); + __ emit_data(0x02030001, relocInfo::none, 0); + __ emit_data(0x06070405, relocInfo::none, 0); + __ emit_data(0x0A0B0809, relocInfo::none, 0); + __ emit_data(0x0E0F0C0D, relocInfo::none, 0); + return start; + } + address generate_vector_byte_shuffle_mask(const char *stub_name) { __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", stub_name); @@ -4090,8 +4206,13 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::x86::_vector_all_bits_set = generate_vector_mask("vector_all_bits_set", 0xFFFFFFFF); StubRoutines::x86::_vector_int_mask_cmp_bits = generate_vector_mask("vector_int_mask_cmp_bits", 0x00000001); StubRoutines::x86::_vector_iota_indices = generate_iota_indices("iota_indices"); + StubRoutines::x86::_vector_count_leading_zeros_lut = generate_count_leading_zeros_lut("count_leading_zeros_lut"); + StubRoutines::x86::_vector_reverse_bit_lut = generate_vector_reverse_bit_lut("reverse_bit_lut"); + StubRoutines::x86::_vector_reverse_byte_perm_mask_long = generate_vector_reverse_byte_perm_mask_long("perm_mask_long"); + StubRoutines::x86::_vector_reverse_byte_perm_mask_int = generate_vector_reverse_byte_perm_mask_int("perm_mask_int"); + StubRoutines::x86::_vector_reverse_byte_perm_mask_short = generate_vector_reverse_byte_perm_mask_short("perm_mask_short"); - if (UsePopCountInstruction && VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) { + if (VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) { // lut implementation influenced by counting 1s algorithm from section 5-1 of Hackers' Delight. StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut("popcount_lut"); } diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index 772533f1e82..ec99c7c80a1 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -807,6 +807,21 @@ class StubGenerator: public StubCodeGenerator { return start; } + address generate_count_leading_zeros_lut(const char *stub_name) { + __ align64(); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data64(0x0101010102020304, relocInfo::none); + __ emit_data64(0x0000000000000000, relocInfo::none); + __ emit_data64(0x0101010102020304, relocInfo::none); + __ emit_data64(0x0000000000000000, relocInfo::none); + __ emit_data64(0x0101010102020304, relocInfo::none); + __ emit_data64(0x0000000000000000, relocInfo::none); + __ emit_data64(0x0101010102020304, relocInfo::none); + __ emit_data64(0x0000000000000000, relocInfo::none); + return start; + } + address generate_popcount_avx_lut(const char *stub_name) { __ align64(); StubCodeMark mark(this, "StubRoutines", stub_name); @@ -837,6 +852,66 @@ class StubGenerator: public StubCodeGenerator { return start; } + address generate_vector_reverse_bit_lut(const char *stub_name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data64(0x0E060A020C040800, relocInfo::none); + __ emit_data64(0x0F070B030D050901, relocInfo::none); + __ emit_data64(0x0E060A020C040800, relocInfo::none); + __ emit_data64(0x0F070B030D050901, relocInfo::none); + __ emit_data64(0x0E060A020C040800, relocInfo::none); + __ emit_data64(0x0F070B030D050901, relocInfo::none); + __ emit_data64(0x0E060A020C040800, relocInfo::none); + __ emit_data64(0x0F070B030D050901, relocInfo::none); + return start; + } + + address generate_vector_reverse_byte_perm_mask_long(const char *stub_name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data64(0x0001020304050607, relocInfo::none); + __ emit_data64(0x08090A0B0C0D0E0F, relocInfo::none); + __ emit_data64(0x0001020304050607, relocInfo::none); + __ emit_data64(0x08090A0B0C0D0E0F, relocInfo::none); + __ emit_data64(0x0001020304050607, relocInfo::none); + __ emit_data64(0x08090A0B0C0D0E0F, relocInfo::none); + __ emit_data64(0x0001020304050607, relocInfo::none); + __ emit_data64(0x08090A0B0C0D0E0F, relocInfo::none); + return start; + } + + address generate_vector_reverse_byte_perm_mask_int(const char *stub_name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data64(0x0405060700010203, relocInfo::none); + __ emit_data64(0x0C0D0E0F08090A0B, relocInfo::none); + __ emit_data64(0x0405060700010203, relocInfo::none); + __ emit_data64(0x0C0D0E0F08090A0B, relocInfo::none); + __ emit_data64(0x0405060700010203, relocInfo::none); + __ emit_data64(0x0C0D0E0F08090A0B, relocInfo::none); + __ emit_data64(0x0405060700010203, relocInfo::none); + __ emit_data64(0x0C0D0E0F08090A0B, relocInfo::none); + return start; + } + + address generate_vector_reverse_byte_perm_mask_short(const char *stub_name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data64(0x0607040502030001, relocInfo::none); + __ emit_data64(0x0E0F0C0D0A0B0809, relocInfo::none); + __ emit_data64(0x0607040502030001, relocInfo::none); + __ emit_data64(0x0E0F0C0D0A0B0809, relocInfo::none); + __ emit_data64(0x0607040502030001, relocInfo::none); + __ emit_data64(0x0E0F0C0D0A0B0809, relocInfo::none); + __ emit_data64(0x0607040502030001, relocInfo::none); + __ emit_data64(0x0E0F0C0D0A0B0809, relocInfo::none); + return start; + } + address generate_vector_byte_shuffle_mask(const char *stub_name) { __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", stub_name); @@ -7955,8 +8030,13 @@ address generate_avx_ghash_processBlocks() { StubRoutines::x86::_vector_long_shuffle_mask = generate_vector_mask("vector_long_shuffle_mask", 0x0000000100000000); StubRoutines::x86::_vector_long_sign_mask = generate_vector_mask("vector_long_sign_mask", 0x8000000000000000); StubRoutines::x86::_vector_iota_indices = generate_iota_indices("iota_indices"); + StubRoutines::x86::_vector_count_leading_zeros_lut = generate_count_leading_zeros_lut("count_leading_zeros_lut"); + StubRoutines::x86::_vector_reverse_bit_lut = generate_vector_reverse_bit_lut("reverse_bit_lut"); + StubRoutines::x86::_vector_reverse_byte_perm_mask_long = generate_vector_reverse_byte_perm_mask_long("perm_mask_long"); + StubRoutines::x86::_vector_reverse_byte_perm_mask_int = generate_vector_reverse_byte_perm_mask_int("perm_mask_int"); + StubRoutines::x86::_vector_reverse_byte_perm_mask_short = generate_vector_reverse_byte_perm_mask_short("perm_mask_short"); - if (UsePopCountInstruction && VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) { + if (VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) { // lut implementation influenced by counting 1s algorithm from section 5-1 of Hackers' Delight. StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut("popcount_lut"); } diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.cpp b/src/hotspot/cpu/x86/stubRoutines_x86.cpp index f5a0eb623d0..95384c82a07 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86.cpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86.cpp @@ -59,7 +59,12 @@ address StubRoutines::x86::_vector_double_sign_flip = NULL; address StubRoutines::x86::_vector_byte_perm_mask = NULL; address StubRoutines::x86::_vector_long_sign_mask = NULL; address StubRoutines::x86::_vector_iota_indices = NULL; +address StubRoutines::x86::_vector_reverse_bit_lut = NULL; +address StubRoutines::x86::_vector_reverse_byte_perm_mask_long = NULL; +address StubRoutines::x86::_vector_reverse_byte_perm_mask_int = NULL; +address StubRoutines::x86::_vector_reverse_byte_perm_mask_short = NULL; address StubRoutines::x86::_vector_popcount_lut = NULL; +address StubRoutines::x86::_vector_count_leading_zeros_lut = NULL; address StubRoutines::x86::_vector_32_bit_mask = NULL; address StubRoutines::x86::_vector_64_bit_mask = NULL; #ifdef _LP64 diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.hpp b/src/hotspot/cpu/x86/stubRoutines_x86.hpp index d5b96089a60..5cc29ac134e 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp @@ -178,6 +178,11 @@ class x86 { static address _vector_long_shuffle_mask; static address _vector_iota_indices; static address _vector_popcount_lut; + static address _vector_count_leading_zeros_lut; + static address _vector_reverse_bit_lut; + static address _vector_reverse_byte_perm_mask_long; + static address _vector_reverse_byte_perm_mask_int; + static address _vector_reverse_byte_perm_mask_short; #ifdef _LP64 static juint _k256_W[]; static address _k256_W_adr; @@ -341,6 +346,26 @@ class x86 { return _vector_iota_indices; } + static address vector_count_leading_zeros_lut() { + return _vector_count_leading_zeros_lut; + } + + static address vector_reverse_bit_lut() { + return _vector_reverse_bit_lut; + } + + static address vector_reverse_byte_perm_mask_long() { + return _vector_reverse_byte_perm_mask_long; + } + + static address vector_reverse_byte_perm_mask_int() { + return _vector_reverse_byte_perm_mask_int; + } + + static address vector_reverse_byte_perm_mask_short() { + return _vector_reverse_byte_perm_mask_short; + } + static address vector_popcount_lut() { return _vector_popcount_lut; } diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index 41a43c7de3c..210aa55dc53 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -922,6 +922,7 @@ void VM_Version::get_processor_features() { _features &= ~CPU_AVX512_VNNI; _features &= ~CPU_AVX512_VBMI; _features &= ~CPU_AVX512_VBMI2; + _features &= ~CPU_AVX512_BITALG; } if (UseAVX < 2) @@ -951,6 +952,8 @@ void VM_Version::get_processor_features() { _features &= ~CPU_AVX512_VBMI2; _features &= ~CPU_CLWB; _features &= ~CPU_FLUSHOPT; + _features &= ~CPU_GFNI; + _features &= ~CPU_AVX512_BITALG; } } diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp index ed1b8b43459..16906258215 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.hpp +++ b/src/hotspot/cpu/x86/vm_version_x86.hpp @@ -370,10 +370,11 @@ protected: decl(AVX512_VBMI, "avx512_vbmi", 45) /* Vector BMI instructions */ \ decl(HV, "hv", 46) /* Hypervisor instructions */ \ decl(SERIALIZE, "serialize", 47) /* CPU SERIALIZE */ \ - \ decl(RDTSCP, "rdtscp", 48) /* RDTSCP instruction */ \ decl(RDPID, "rdpid", 49) /* RDPID instruction */ \ - decl(FSRM, "fsrm", 50) /* Fast Short REP MOV */ + decl(FSRM, "fsrm", 50) /* Fast Short REP MOV */ \ + decl(GFNI, "gfni", 51) /* Vector GFNI instructions */ \ + decl(AVX512_BITALG, "avx512_bitalg", 52) /* Vector sub-word popcount and bit gather instructions */ #define DECLARE_CPU_FEATURE_FLAG(id, name, bit) CPU_##id = (1ULL << bit), CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_FLAG) @@ -603,8 +604,12 @@ protected: result |= CPU_AVX512_VPCLMULQDQ; if (_cpuid_info.sef_cpuid7_ecx.bits.vaes != 0) result |= CPU_AVX512_VAES; + if (_cpuid_info.sef_cpuid7_ecx.bits.gfni != 0) + result |= CPU_GFNI; if (_cpuid_info.sef_cpuid7_ecx.bits.avx512_vnni != 0) result |= CPU_AVX512_VNNI; + if (_cpuid_info.sef_cpuid7_ecx.bits.avx512_bitalg != 0) + result |= CPU_AVX512_BITALG; if (_cpuid_info.sef_cpuid7_ecx.bits.avx512_vbmi != 0) result |= CPU_AVX512_VBMI; if (_cpuid_info.sef_cpuid7_ecx.bits.avx512_vbmi2 != 0) @@ -918,7 +923,9 @@ public: static bool supports_avx512_vpopcntdq() { return (_features & CPU_AVX512_VPOPCNTDQ) != 0; } static bool supports_avx512_vpclmulqdq() { return (_features & CPU_AVX512_VPCLMULQDQ) != 0; } static bool supports_avx512_vaes() { return (_features & CPU_AVX512_VAES) != 0; } + static bool supports_gfni() { return (_features & CPU_GFNI) != 0; } static bool supports_avx512_vnni() { return (_features & CPU_AVX512_VNNI) != 0; } + static bool supports_avx512_bitalg() { return (_features & CPU_AVX512_BITALG) != 0; } static bool supports_avx512_vbmi() { return (_features & CPU_AVX512_VBMI) != 0; } static bool supports_avx512_vbmi2() { return (_features & CPU_AVX512_VBMI2) != 0; } static bool supports_hv() { return (_features & CPU_HV) != 0; } diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index 64212d9f7bd..07ed62f293d 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -1241,10 +1241,20 @@ static inline Assembler::AvxVectorLen vector_length_encoding(const MachNode* use return vector_length_encoding(def); } +static inline bool is_vector_popcount_predicate(BasicType bt) { + return (is_subword_type(bt) && VM_Version::supports_avx512_bitalg()) || + (is_non_subword_integral_type(bt) && VM_Version::supports_avx512_vpopcntdq()); +} + static inline bool is_unsigned_booltest_pred(int bt) { return ((bt & BoolTest::unsigned_compare) == BoolTest::unsigned_compare); } +static inline bool is_clz_non_subword_predicate_evex(BasicType bt, int vlen_bytes) { + return is_non_subword_integral_type(bt) && VM_Version::supports_avx512cd() && + (VM_Version::supports_avx512vl() || vlen_bytes == 64); +} + class Node::PD { public: enum NodeFlags { @@ -1405,12 +1415,12 @@ const bool Matcher::match_rule_supported(int opcode) { } break; case Op_PopCountVI: - if (!UsePopCountInstruction || (UseAVX < 2)) { + if (UseAVX < 2) { return false; } break; case Op_PopCountVL: - if (!UsePopCountInstruction || (UseAVX <= 2)) { + if (UseAVX < 2) { return false; } break; @@ -1630,6 +1640,17 @@ const bool Matcher::match_rule_supported(int opcode) { return false; } break; + case Op_CompressM: + if (!VM_Version::supports_avx512vl() || !VM_Version::supports_bmi2()) { + return false; + } + break; + case Op_CompressV: + case Op_ExpandV: + if (!VM_Version::supports_avx512vl()) { + return false; + } + break; case Op_SqrtF: if (UseSSE < 1) { return false; @@ -1651,6 +1672,11 @@ const bool Matcher::match_rule_supported(int opcode) { //------------------------------------------------------------------------ +static inline bool is_pop_count_instr_target(BasicType bt) { + return (is_subword_type(bt) && VM_Version::supports_avx512_bitalg()) || + (is_non_subword_integral_type(bt) && VM_Version::supports_avx512_vpopcntdq()); +} + // Identify extra cases that we might want to provide match rules for vector nodes and // other intrinsics guarded with vector length (vlen) and element type (bt). const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType bt) { @@ -1860,7 +1886,7 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType case Op_LoadVectorGatherMasked: case Op_StoreVectorScatterMasked: case Op_StoreVectorScatter: - if(is_subword_type(bt)) { + if (is_subword_type(bt)) { return false; } else if (size_in_bits < 512 && !VM_Version::supports_avx512vl()) { return false; @@ -1887,6 +1913,23 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType return false; } break; + case Op_CompressM: + if (UseAVX < 3 || !VM_Version::supports_bmi2()) { + return false; + } + break; + case Op_CompressV: + case Op_ExpandV: + if (is_subword_type(bt) && !VM_Version::supports_avx512_vbmi2()) { + return false; + } + if (size_in_bits < 128 ) { + return false; + } + if (size_in_bits < 512 && !VM_Version::supports_avx512vl()) { + return false; + } + break; case Op_VectorLongToMask: if (UseAVX < 1 || !is_LP64) { return false; @@ -1902,14 +1945,22 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType } break; case Op_PopCountVI: - if (!VM_Version::supports_avx512_vpopcntdq() && - (vlen == 16) && !VM_Version::supports_avx512bw()) { + case Op_PopCountVL: { + if (!is_pop_count_instr_target(bt) && + (size_in_bits == 512) && !VM_Version::supports_avx512bw()) { + return false; + } + } + break; + case Op_ReverseV: + case Op_ReverseBytesV: + if (UseAVX < 2) { return false; } break; - case Op_PopCountVL: - if (!VM_Version::supports_avx512_vpopcntdq() && - ((vlen <= 4) || ((vlen == 8) && !VM_Version::supports_avx512bw()))) { + case Op_CountTrailingZerosV: + case Op_CountLeadingZerosV: + if (UseAVX < 2) { return false; } break; @@ -2057,9 +2108,20 @@ const bool Matcher::match_rule_supported_vector_masked(int opcode, int vlen, Bas } return true; + case Op_PopCountVI: + case Op_PopCountVL: + if (!is_pop_count_instr_target(bt)) { + return false; + } + return true; + case Op_MaskAll: return true; + case Op_CountLeadingZerosV: + if (is_non_subword_integral_type(bt) && VM_Version::supports_avx512cd()) { + return true; + } default: return false; } @@ -8705,58 +8767,151 @@ instruct vmuladdaddS2I_reg(vec dst, vec src1, vec src2) %{ // --------------------------------- PopCount -------------------------------------- -instruct vpopcountI_popcntd(vec dst, vec src) %{ - predicate(VM_Version::supports_avx512_vpopcntdq()); +instruct vpopcount_integral_reg_evex(vec dst, vec src) %{ + predicate(is_vector_popcount_predicate(Matcher::vector_element_basic_type(n->in(1)))); match(Set dst (PopCountVI src)); - format %{ "vector_popcount_int $dst, $src\t! vector popcount packedI" %} + match(Set dst (PopCountVL src)); + ins_cost(400); + format %{ "vector_popcount_integral $dst, $src" %} ins_encode %{ - assert(UsePopCountInstruction, "not enabled"); - int vlen_enc = vector_length_encoding(this); - __ vector_popcount_int($dst$$XMMRegister, $src$$XMMRegister, xnoreg, xnoreg, xnoreg, noreg, vlen_enc); + int opcode = this->ideal_Opcode(); + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + __ vector_popcount_integral_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, k0, true, vlen_enc); + // TODO: Once auto-vectorizer supports ConvL2I operation, PopCountVL + // should be succeeded by its corresponding vector IR and following + // special handling should be removed. + if (opcode == Op_PopCountVL && Matcher::vector_element_basic_type(this) == T_INT) { + __ evpmovqd($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc); + } %} ins_pipe( pipe_slow ); %} -instruct vpopcountI(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3, rRegP rtmp, rFlagsReg cc) %{ - predicate(!VM_Version::supports_avx512_vpopcntdq()); +instruct vpopcount_integral_reg_evex_masked(vec dst, vec src, kReg mask) %{ + predicate(is_vector_popcount_predicate(Matcher::vector_element_basic_type(n->in(1)))); + match(Set dst (PopCountVI src mask)); + match(Set dst (PopCountVL src mask)); + format %{ "vector_popcount_integral_masked $dst, $src, $mask" %} + ins_encode %{ + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + __ evmovdquq($dst$$XMMRegister, $src$$XMMRegister, vlen_enc); + __ vector_popcount_integral_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, $mask$$KRegister, true, vlen_enc); + %} + ins_pipe( pipe_slow ); +%} + +instruct vpopcount_avx_reg(vec dst, vec src, vec xtmp1, vec xtmp2, rRegP rtmp) %{ + predicate(!is_vector_popcount_predicate(Matcher::vector_element_basic_type(n->in(1)))); match(Set dst (PopCountVI src)); - effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3, TEMP rtmp, KILL cc); - format %{ "vector_popcount_int $dst, $src\t! using $xtmp1, $xtmp2, $xtmp3, and $rtmp as TEMP" %} + match(Set dst (PopCountVL src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP rtmp); + format %{ "vector_popcount_integral $dst, $src\t! using $xtmp1, $xtmp2, and $rtmp as TEMP" %} ins_encode %{ - assert(UsePopCountInstruction, "not enabled"); - int vlen_enc = vector_length_encoding(this); - __ vector_popcount_int($dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, $xtmp2$$XMMRegister, - $xtmp3$$XMMRegister, $rtmp$$Register, vlen_enc); + int opcode = this->ideal_Opcode(); + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + __ vector_popcount_integral(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, $rtmp$$Register, vlen_enc); + // TODO: Once auto-vectorizer supports ConvL2I operation, PopCountVL + // should be succeeded by its corresponding vector IR and following + // special handling should be removed. + if (opcode == Op_PopCountVL && Matcher::vector_element_basic_type(this) == T_INT) { + if (VM_Version::supports_avx512vl()) { + __ evpmovqd($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc); + } else { + assert(VM_Version::supports_avx2(), ""); + __ vpshufd($dst$$XMMRegister, $dst$$XMMRegister, 8, vlen_enc); + __ vpermq($dst$$XMMRegister, $dst$$XMMRegister, 8, vlen_enc); + } + } %} ins_pipe( pipe_slow ); %} -instruct vpopcountL_popcntd(vec dst, vec src) %{ - predicate(VM_Version::supports_avx512_vpopcntdq()); - match(Set dst (PopCountVL src)); - format %{ "vector_popcount_long $dst, $src\t! vector popcount packedL" %} +// --------------------------------- Vector Trailing Zeros Count -------------------------------------- + +instruct vcount_trailing_zeros_reg_evex(vec dst, vec src, vec xtmp, rRegP rtmp) %{ + predicate(is_clz_non_subword_predicate_evex(Matcher::vector_element_basic_type(n->in(1)), + Matcher::vector_length_in_bytes(n->in(1)))); + match(Set dst (CountTrailingZerosV src)); + effect(TEMP dst, TEMP xtmp, TEMP rtmp); + ins_cost(400); + format %{ "vector_count_trailing_zeros $dst, $src!\t using $xtmp and $rtmp as TEMP" %} ins_encode %{ - assert(UsePopCountInstruction, "not enabled"); int vlen_enc = vector_length_encoding(this, $src); - __ vector_popcount_long($dst$$XMMRegister, $src$$XMMRegister, xnoreg, xnoreg, xnoreg, noreg, vlen_enc); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + BasicType rbt = Matcher::vector_element_basic_type(this); + __ vector_count_trailing_zeros_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, xnoreg, + xnoreg, xnoreg, $xtmp$$XMMRegister, k0, $rtmp$$Register, vlen_enc); + // TODO: Once auto-vectorizer supports ConvL2I operation, CountTrailingZerosV + // should be succeeded by its corresponding vector IR and following + // special handling should be removed. + if (bt == T_LONG && rbt == T_INT) { + __ evpmovqd($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc); + } %} ins_pipe( pipe_slow ); %} -instruct vpopcountL(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3, rRegP rtmp, rFlagsReg cc) %{ - predicate(!VM_Version::supports_avx512_vpopcntdq()); - match(Set dst (PopCountVL src)); - effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3, TEMP rtmp, KILL cc); - format %{ "vector_popcount_long $dst, $src\t! using $xtmp1, $xtmp2, $xtmp3, and $rtmp as TEMP" %} +instruct vcount_trailing_zeros_short_reg_evex(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3, rRegP rtmp) %{ + predicate(Matcher::vector_element_basic_type(n->in(1)) == T_SHORT && + VM_Version::supports_avx512cd() && + (VM_Version::supports_avx512vl() || Matcher::vector_length_in_bytes(n) == 64)); + match(Set dst (CountTrailingZerosV src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3, TEMP rtmp); + ins_cost(400); + format %{ "vector_count_trailing_zeros $dst, $src!\t using $xtmp1, $xtmp2, $xtmp3 and $rtmp as TEMP" %} ins_encode %{ - assert(UsePopCountInstruction, "not enabled"); int vlen_enc = vector_length_encoding(this, $src); - __ vector_popcount_long($dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, $xtmp2$$XMMRegister, - $xtmp3$$XMMRegister, $rtmp$$Register, vlen_enc); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + __ vector_count_trailing_zeros_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, xnoreg, $xtmp3$$XMMRegister, k0, $rtmp$$Register, vlen_enc); %} ins_pipe( pipe_slow ); %} +instruct vcount_trailing_zeros_byte_reg_evex(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3, vec xtmp4, kReg ktmp, rRegP rtmp) %{ + predicate(Matcher::vector_element_basic_type(n->in(1)) == T_BYTE && VM_Version::supports_avx512vlbw()); + match(Set dst (CountTrailingZerosV src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3, TEMP xtmp4, TEMP ktmp, TEMP rtmp); + ins_cost(400); + format %{ "vector_count_trailing_zeros $dst, $src!\t using $xtmp1, $xtmp2, $xtmp3, $xtmp4, $ktmp and $rtmp as TEMP" %} + ins_encode %{ + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + __ vector_count_trailing_zeros_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, $xtmp3$$XMMRegister, $xtmp4$$XMMRegister, + $ktmp$$KRegister, $rtmp$$Register, vlen_enc); + %} + ins_pipe( pipe_slow ); +%} + +instruct vcount_trailing_zeros_reg_avx(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3, rRegP rtmp) %{ + predicate(!VM_Version::supports_avx512vl() && Matcher::vector_length_in_bytes(n->in(1)) < 64); + match(Set dst (CountTrailingZerosV src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3, TEMP rtmp); + format %{ "vector_count_trailing_zeros $dst, $src\t! using $xtmp1, $xtmp2, $xtmp3, and $rtmp as TEMP" %} + ins_encode %{ + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + BasicType rbt = Matcher::vector_element_basic_type(this); + __ vector_count_trailing_zeros_avx(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, $xtmp3$$XMMRegister, $rtmp$$Register, vlen_enc); + // TODO: Once auto-vectorizer supports ConvL2I operation, PopCountVL + // should be succeeded by its corresponding vector IR and following + // special handling should be removed. + if (bt == T_LONG && rbt == T_INT) { + assert(VM_Version::supports_avx2(), ""); + __ vpshufd($dst$$XMMRegister, $dst$$XMMRegister, 8, vlen_enc); + __ vpermq($dst$$XMMRegister, $dst$$XMMRegister, 8, vlen_enc); + } + %} + ins_pipe( pipe_slow ); +%} + + // --------------------------------- Bitwise Ternary Logic ---------------------------------- instruct vpternlog(vec dst, vec src2, vec src3, immU8 func) %{ @@ -9031,8 +9186,200 @@ instruct vmask_first_or_last_true_avx(rRegI dst, vec mask, immI size, rRegL tmp, %} ins_pipe( pipe_slow ); %} + +// --------------------------------- Compress/Expand Operations --------------------------- + +instruct vcompress_expand_reg_evex(vec dst, vec src, kReg mask) %{ + match(Set dst (CompressV src mask)); + match(Set dst (ExpandV src mask)); + format %{ "vector_compress_expand $dst, $src, $mask" %} + ins_encode %{ + int opcode = this->ideal_Opcode(); + int vector_len = vector_length_encoding(this); + BasicType bt = Matcher::vector_element_basic_type(this); + __ vector_compress_expand(opcode, $dst$$XMMRegister, $src$$XMMRegister, $mask$$KRegister, false, bt, vector_len); + %} + ins_pipe( pipe_slow ); +%} + +instruct vcompress_mask_reg_evex(kReg dst, kReg mask, rRegL rtmp1, rRegL rtmp2, rFlagsReg cr) %{ + match(Set dst (CompressM mask)); + effect(TEMP rtmp1, TEMP rtmp2, KILL cr); + format %{ "mask_compress_evex $dst, $mask\t! using $rtmp1 and $rtmp2 as TEMP" %} + ins_encode %{ + assert(this->in(1)->bottom_type()->isa_vectmask(), ""); + int mask_len = Matcher::vector_length(this); + __ vector_mask_compress($dst$$KRegister, $mask$$KRegister, $rtmp1$$Register, $rtmp2$$Register, mask_len); + %} + ins_pipe( pipe_slow ); +%} + #endif // _LP64 +// -------------------------------- Bit and Byte Reversal Vector Operations ------------------------ + +instruct vreverse_reg(vec dst, vec src, vec xtmp1, vec xtmp2, rRegI rtmp) %{ + predicate(!VM_Version::supports_gfni()); + match(Set dst (ReverseV src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP rtmp); + format %{ "vector_reverse_bit_evex $dst, $src!\t using $xtmp1, $xtmp2 and $rtmp as TEMP" %} + ins_encode %{ + int vec_enc = vector_length_encoding(this); + BasicType bt = Matcher::vector_element_basic_type(this); + __ vector_reverse_bit(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, $rtmp$$Register, vec_enc); + %} + ins_pipe( pipe_slow ); +%} + +instruct vreverse_reg_gfni(vec dst, vec src, vec xtmp, rRegI rtmp) %{ + predicate(VM_Version::supports_gfni()); + match(Set dst (ReverseV src)); + effect(TEMP dst, TEMP xtmp, TEMP rtmp); + format %{ "vector_reverse_bit_gfni $dst, $src!\t using $rtmp and $xtmp as TEMP" %} + ins_encode %{ + int vec_enc = vector_length_encoding(this); + BasicType bt = Matcher::vector_element_basic_type(this); + InternalAddress addr = $constantaddress(T_LONG, vreplicate_imm(T_LONG, 0x8040201008040201L, 1)); + __ vector_reverse_bit_gfni(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp$$XMMRegister, + addr, $rtmp$$Register, vec_enc); + %} + ins_pipe( pipe_slow ); +%} + +instruct vreverse_byte_reg(vec dst, vec src, rRegI rtmp) %{ + predicate(VM_Version::supports_avx512bw() || Matcher::vector_length_in_bytes(n) < 64); + match(Set dst (ReverseBytesV src)); + effect(TEMP dst, TEMP rtmp); + format %{ "vector_reverse_byte $dst, $src!\t using $rtmp as TEMP" %} + ins_encode %{ + int vec_enc = vector_length_encoding(this); + BasicType bt = Matcher::vector_element_basic_type(this); + __ vector_reverse_byte(bt, $dst$$XMMRegister, $src$$XMMRegister, $rtmp$$Register, vec_enc); + %} + ins_pipe( pipe_slow ); +%} + +instruct vreverse_byte64_reg(vec dst, vec src, vec xtmp1, vec xtmp2, rRegI rtmp) %{ + predicate(!VM_Version::supports_avx512bw() && Matcher::vector_length_in_bytes(n) == 64); + match(Set dst (ReverseBytesV src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP rtmp); + format %{ "vector_reverse_byte $dst, $src!\t using $xtmp1, $xtmp2 and $rtmp as TEMP" %} + ins_encode %{ + int vec_enc = vector_length_encoding(this); + BasicType bt = Matcher::vector_element_basic_type(this); + __ vector_reverse_byte64(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, $rtmp$$Register, vec_enc); + %} + ins_pipe( pipe_slow ); +%} + +// ---------------------------------- Vector Count Leading Zeros ----------------------------------- + +instruct vcount_leading_zeros_IL_reg_evex(vec dst, vec src) %{ + predicate(is_clz_non_subword_predicate_evex(Matcher::vector_element_basic_type(n->in(1)), + Matcher::vector_length_in_bytes(n->in(1)))); + match(Set dst (CountLeadingZerosV src)); + format %{ "vector_count_leading_zeros $dst, $src" %} + ins_encode %{ + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + BasicType rbt = Matcher::vector_element_basic_type(this); + __ vector_count_leading_zeros_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, xnoreg, + xnoreg, xnoreg, k0, noreg, true, vlen_enc); + // TODO: Once auto-vectorizer supports ConvL2I operation, CountLeadingZerosV + // should be succeeded by its corresponding vector IR and following + // special handling should be removed. + if (rbt == T_INT && bt == T_LONG) { + __ evpmovqd($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc); + } + %} + ins_pipe( pipe_slow ); +%} + +instruct vcount_leading_zeros_IL_reg_evex_masked(vec dst, vec src, kReg mask) %{ + predicate(is_clz_non_subword_predicate_evex(Matcher::vector_element_basic_type(n->in(1)), + Matcher::vector_length_in_bytes(n->in(1)))); + match(Set dst (CountLeadingZerosV src mask)); + format %{ "vector_count_leading_zeros $dst, $src, $mask" %} + ins_encode %{ + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + __ evmovdquq($dst$$XMMRegister, $src$$XMMRegister, vlen_enc); + __ vector_count_leading_zeros_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, xnoreg, xnoreg, + xnoreg, $mask$$KRegister, noreg, true, vlen_enc); + %} + ins_pipe( pipe_slow ); +%} + +instruct vcount_leading_zeros_short_reg_evex(vec dst, vec src, vec xtmp1, vec xtmp2) %{ + predicate(Matcher::vector_element_basic_type(n->in(1)) == T_SHORT && + VM_Version::supports_avx512cd() && + (VM_Version::supports_avx512vl() || Matcher::vector_length_in_bytes(n) == 64)); + match(Set dst (CountLeadingZerosV src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2); + format %{ "vector_count_leading_zeros $dst, $src!\t using $xtmp1 and $xtmp2 as TEMP" %} + ins_encode %{ + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + __ vector_count_leading_zeros_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, xnoreg, k0, noreg, true, vlen_enc); + %} + ins_pipe( pipe_slow ); +%} + +instruct vcount_leading_zeros_byte_reg_evex(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3, kReg ktmp, rRegP rtmp) %{ + predicate(Matcher::vector_element_basic_type(n->in(1)) == T_BYTE && VM_Version::supports_avx512vlbw()); + match(Set dst (CountLeadingZerosV src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3, TEMP ktmp, TEMP rtmp); + format %{ "vector_count_leading_zeros $dst, $src!\t using $xtmp1, $xtmp2, $xtmp3, $ktmp and $rtmp as TEMP" %} + ins_encode %{ + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + __ vector_count_leading_zeros_evex(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, $xtmp3$$XMMRegister, $ktmp$$KRegister, + $rtmp$$Register, true, vlen_enc); + %} + ins_pipe( pipe_slow ); +%} + +instruct vcount_leading_zeros_int_reg_avx(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3) %{ + predicate(Matcher::vector_element_basic_type(n->in(1)) == T_INT && + !VM_Version::supports_avx512vl() && Matcher::vector_length_in_bytes(n->in(1)) < 64); + match(Set dst (CountLeadingZerosV src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3); + format %{ "vector_count_leading_zeros $dst, $src\t! using $xtmp1, $xtmp2 and $xtmp3 as TEMP" %} + ins_encode %{ + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + __ vector_count_leading_zeros_avx(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, $xtmp3$$XMMRegister, noreg, vlen_enc); + %} + ins_pipe( pipe_slow ); +%} + +instruct vcount_leading_zeros_reg_avx(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3, rRegP rtmp) %{ + predicate(Matcher::vector_element_basic_type(n->in(1)) != T_INT && + !VM_Version::supports_avx512vl() && Matcher::vector_length_in_bytes(n->in(1)) < 64); + match(Set dst (CountLeadingZerosV src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3, TEMP rtmp); + format %{ "vector_count_leading_zeros $dst, $src\t! using $xtmp1, $xtmp2, $xtmp3, and $rtmp as TEMP" %} + ins_encode %{ + int vlen_enc = vector_length_encoding(this, $src); + BasicType bt = Matcher::vector_element_basic_type(this, $src); + BasicType rbt = Matcher::vector_element_basic_type(this); + __ vector_count_leading_zeros_avx(bt, $dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, + $xtmp2$$XMMRegister, $xtmp3$$XMMRegister, $rtmp$$Register, vlen_enc); + // TODO: Once auto-vectorizer supports ConvL2I operation, CountLeadingZerosV + // should be succeeded by its corresponding vector IR and following + // special handling should be removed. + if (rbt == T_INT && bt == T_LONG) { + __ evpmovqd($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc); + } + %} + ins_pipe( pipe_slow ); +%} + // ---------------------------------- Vector Masked Operations ------------------------------------ instruct vadd_reg_masked(vec dst, vec src2, kReg mask) %{ diff --git a/src/hotspot/share/adlc/formssel.cpp b/src/hotspot/share/adlc/formssel.cpp index 216e6c579e6..0137c71503a 100644 --- a/src/hotspot/share/adlc/formssel.cpp +++ b/src/hotspot/share/adlc/formssel.cpp @@ -4212,6 +4212,7 @@ bool MatchRule::is_vector() const { "SqrtVD","SqrtVF", "AndV" ,"XorV" ,"OrV", "MaxV", "MinV", + "CompressV", "ExpandV", "CompressM", "AddReductionVI", "AddReductionVL", "AddReductionVF", "AddReductionVD", "MulReductionVI", "MulReductionVL", @@ -4223,7 +4224,7 @@ bool MatchRule::is_vector() const { "LShiftVB","LShiftVS","LShiftVI","LShiftVL", "RShiftVB","RShiftVS","RShiftVI","RShiftVL", "URShiftVB","URShiftVS","URShiftVI","URShiftVL", - "ReplicateB","ReplicateS","ReplicateI","ReplicateL","ReplicateF","ReplicateD","PopulateIndex", + "ReplicateB","ReplicateS","ReplicateI","ReplicateL","ReplicateF","ReplicateD","ReverseV","ReverseBytesV", "RoundDoubleModeV","RotateLeftV" , "RotateRightV", "LoadVector","StoreVector", "LoadVectorGather", "StoreVectorScatter", "LoadVectorGatherMasked", "StoreVectorScatterMasked", "VectorTest", "VectorLoadMask", "VectorStoreMask", "VectorBlend", "VectorInsert", @@ -4232,7 +4233,8 @@ bool MatchRule::is_vector() const { "VectorCastL2X", "VectorCastF2X", "VectorCastD2X", "VectorUCastB2X", "VectorUCastS2X", "VectorUCastI2X", "VectorMaskWrapper","VectorMaskCmp","VectorReinterpret","LoadVectorMasked","StoreVectorMasked", - "FmaVD","FmaVF","PopCountVI", "PopCountVL", "SignumVF", "SignumVD", "VectorLongToMask", + "FmaVD","FmaVF","PopCountVI","PopCountVL","PopulateIndex","VectorLongToMask", + "CountLeadingZerosV", "CountTrailingZerosV", "SignumVF", "SignumVD", // Next are vector mask ops. "MaskAll", "AndVMask", "OrVMask", "XorVMask", "VectorMaskCast", "RoundVF", "RoundVD", diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp b/src/hotspot/share/classfile/vmIntrinsics.hpp index 67ddd1fbf0f..a6d155c1619 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.hpp +++ b/src/hotspot/share/classfile/vmIntrinsics.hpp @@ -935,7 +935,7 @@ class methodHandle; "Ljava/lang/Object;" \ "J" \ "Ljava/lang/Object;" \ - "I" \ + "J" \ "Ljdk/internal/vm/vector/VectorSupport$VectorSpecies;" \ "Ljdk/internal/vm/vector/VectorSupport$LoadOperation;)" \ "Ljdk/internal/vm/vector/VectorSupport$VectorPayload;") \ @@ -950,7 +950,7 @@ class methodHandle; "J" \ "Ljdk/internal/vm/vector/VectorSupport$VectorMask;" \ "Ljava/lang/Object;" \ - "I" \ + "J" \ "Ljdk/internal/vm/vector/VectorSupport$VectorSpecies;" \ "Ljdk/internal/vm/vector/VectorSupport$LoadVectorMaskedOperation;)" \ "Ljdk/internal/vm/vector/VectorSupport$Vector;") \ @@ -962,8 +962,10 @@ class methodHandle; "I" \ "Ljava/lang/Object;" \ "J" \ - "Ljdk/internal/vm/vector/VectorSupport$Vector;" \ - "Ljava/lang/Object;ILjdk/internal/vm/vector/VectorSupport$StoreVectorOperation;)" \ + "Ljdk/internal/vm/vector/VectorSupport$VectorPayload;" \ + "Ljava/lang/Object;" \ + "J" \ + "Ljdk/internal/vm/vector/VectorSupport$StoreVectorOperation;)" \ "V") \ do_name(vector_store_op_name, "store") \ \ @@ -977,7 +979,7 @@ class methodHandle; "Ljdk/internal/vm/vector/VectorSupport$Vector;" \ "Ljdk/internal/vm/vector/VectorSupport$VectorMask;" \ "Ljava/lang/Object;" \ - "I" \ + "J" \ "Ljdk/internal/vm/vector/VectorSupport$StoreVectorMaskedOperation;)" \ "V") \ do_name(vector_store_masked_op_name, "storeMasked") \ @@ -1137,6 +1139,17 @@ class methodHandle; "J") \ do_name(vector_mask_oper_name, "maskReductionCoerced") \ \ + do_intrinsic(_VectorCompressExpand, jdk_internal_vm_vector_VectorSupport, vector_compress_expand_op_name, vector_compress_expand_op_sig, F_S)\ + do_signature(vector_compress_expand_op_sig, "(I" \ + "Ljava/lang/Class;" \ + "Ljava/lang/Class;" \ + "Ljava/lang/Class;" \ + "I" \ + "Ljdk/internal/vm/vector/VectorSupport$Vector;" \ + "Ljdk/internal/vm/vector/VectorSupport$VectorMask;" \ + "Ljdk/internal/vm/vector/VectorSupport$CompressExpandOperation;)" \ + "Ljdk/internal/vm/vector/VectorSupport$VectorPayload;") \ + do_name(vector_compress_expand_op_name, "compressExpandOp") \ /* (2) Bytecode intrinsics */ \ \ do_intrinsic(_park, jdk_internal_misc_Unsafe, park_name, park_signature, F_RN) \ @@ -1245,7 +1258,7 @@ enum class vmIntrinsicID : int { __IGNORE_CLASS, __IGNORE_NAME, __IGNORE_SIGNATURE, __IGNORE_ALIAS) ID_LIMIT, - LAST_COMPILER_INLINE = _VectorMaskOp, + LAST_COMPILER_INLINE = _VectorCompressExpand, FIRST_MH_SIG_POLY = _invokeGeneric, FIRST_MH_STATIC = _linkToVirtual, LAST_MH_SIG_POLY = _linkToNative, diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp index 075191ff912..62d0ff96bc0 100644 --- a/src/hotspot/share/opto/c2compiler.cpp +++ b/src/hotspot/share/opto/c2compiler.cpp @@ -715,6 +715,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt case vmIntrinsics::_Continuation_doYield: break; + case vmIntrinsics::_VectorCompressExpand: case vmIntrinsics::_VectorUnaryOp: case vmIntrinsics::_VectorBinaryOp: case vmIntrinsics::_VectorTernaryOp: diff --git a/src/hotspot/share/opto/classes.hpp b/src/hotspot/share/opto/classes.hpp index f0826a6fc26..6dcdd18f510 100644 --- a/src/hotspot/share/opto/classes.hpp +++ b/src/hotspot/share/opto/classes.hpp @@ -51,6 +51,7 @@ macro(ReverseBytesI) macro(ReverseBytesL) macro(ReverseBytesUS) macro(ReverseBytesS) +macro(ReverseBytesV) macro(CProj) macro(CacheWB) macro(CacheWBPreSync) @@ -74,6 +75,8 @@ macro(Catch) macro(CatchProj) macro(CheckCastPP) macro(ClearArray) +macro(CompressBits) +macro(ExpandBits) macro(ConstraintCast) macro(CMoveD) macro(CMoveVD) @@ -152,8 +155,10 @@ macro(LongCountedLoop) macro(LongCountedLoopEnd) macro(CountLeadingZerosI) macro(CountLeadingZerosL) +macro(CountLeadingZerosV) macro(CountTrailingZerosI) macro(CountTrailingZerosL) +macro(CountTrailingZerosV) macro(CreateEx) macro(DecodeN) macro(DecodeNKlass) @@ -285,6 +290,9 @@ macro(RShiftL) macro(Region) macro(Rethrow) macro(Return) +macro(ReverseI) +macro(ReverseL) +macro(ReverseV) macro(Root) macro(RoundDouble) macro(RoundDoubleMode) @@ -424,6 +432,9 @@ macro(MinV) macro(MaxV) macro(MinReductionV) macro(MaxReductionV) +macro(CompressV) +macro(CompressM) +macro(ExpandV) macro(LoadVector) macro(LoadVectorGather) macro(LoadVectorGatherMasked) diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 060d2a18352..f5406d6b777 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -700,6 +700,8 @@ bool LibraryCallKit::try_to_inline(int predicate) { return inline_vector_insert(); case vmIntrinsics::_VectorExtract: return inline_vector_extract(); + case vmIntrinsics::_VectorCompressExpand: + return inline_vector_compress_expand(); case vmIntrinsics::_getObjectSize: return inline_getObjectSize(); diff --git a/src/hotspot/share/opto/library_call.hpp b/src/hotspot/share/opto/library_call.hpp index 3135356e565..9935ae49376 100644 --- a/src/hotspot/share/opto/library_call.hpp +++ b/src/hotspot/share/opto/library_call.hpp @@ -344,6 +344,8 @@ class LibraryCallKit : public GraphKit { bool inline_vector_convert(); bool inline_vector_extract(); bool inline_vector_insert(); + bool inline_vector_compress_expand(); + Node* gen_call_to_svml(int vector_api_op_id, BasicType bt, int num_elem, Node* opd1, Node* opd2); enum VectorMaskUseType { diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index 0ccd1e264db..9e8148ce220 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -974,6 +974,9 @@ bool IdealLoopTree::policy_unroll(PhaseIdealLoop *phase) { case Op_RoundD: { body_size += Matcher::scalar_op_pre_select_sz_estimate(n->Opcode(), n->bottom_type()->basic_type()); } break; + case Op_CountTrailingZerosV: + case Op_CountLeadingZerosV: + case Op_ReverseV: case Op_RoundVF: case Op_RoundVD: case Op_PopCountVI: diff --git a/src/hotspot/share/opto/matcher.cpp b/src/hotspot/share/opto/matcher.cpp index 9f0196864db..6bbfd5e21b1 100644 --- a/src/hotspot/share/opto/matcher.cpp +++ b/src/hotspot/share/opto/matcher.cpp @@ -2254,6 +2254,9 @@ bool Matcher::find_shared_visit(MStack& mstack, Node* n, uint opcode, bool& mem_ case Op_MacroLogicV: case Op_LoadVectorMasked: case Op_VectorCmpMasked: + case Op_CompressV: + case Op_CompressM: + case Op_ExpandV: case Op_VectorLoadMask: set_shared(n); // Force result into register (it will be anyways) break; diff --git a/src/hotspot/share/opto/mulnode.hpp b/src/hotspot/share/opto/mulnode.hpp index a28f700da7a..e281684f19a 100644 --- a/src/hotspot/share/opto/mulnode.hpp +++ b/src/hotspot/share/opto/mulnode.hpp @@ -389,4 +389,20 @@ public: virtual uint ideal_reg() const { return Op_RegI; } }; +//------------------------------CompressBitsNode------------------------------- +// CompressBits placeholder node +class CompressBitsNode : public Node { +public: + CompressBitsNode(Node *in1, Node *in2) : Node(0,in1,in2) {} + virtual int Opcode() const; +}; + +//------------------------------ExpandBitsNode--------------------------------- +// ExpandBits placeholder node +class ExpandBitsNode : public Node { +public: + ExpandBitsNode(Node *in1, Node *in2) : Node(0,in1,in2) {} + virtual int Opcode() const; +}; + #endif // SHARE_OPTO_MULNODE_HPP diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index fa83ae85a46..c92f28a652f 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -175,6 +175,9 @@ class VectorUnboxNode; class VectorSet; class VectorReinterpretNode; class ShiftVNode; +class ExpandVNode; +class CompressVNode; +class CompressMNode; #ifndef OPTO_DU_ITERATOR_ASSERT @@ -704,6 +707,9 @@ public: DEFINE_CLASS_ID(VectorUnbox, Vector, 1) DEFINE_CLASS_ID(VectorReinterpret, Vector, 2) DEFINE_CLASS_ID(ShiftV, Vector, 3) + DEFINE_CLASS_ID(CompressV, Vector, 4) + DEFINE_CLASS_ID(ExpandV, Vector, 5) + DEFINE_CLASS_ID(CompressM, Vector, 6) DEFINE_CLASS_ID(Proj, Node, 3) DEFINE_CLASS_ID(CatchProj, Proj, 0) @@ -777,7 +783,8 @@ public: Flag_is_predicated_vector = 1 << 14, Flag_for_post_loop_opts_igvn = 1 << 15, Flag_is_removed_by_peephole = 1 << 16, - _last_flag = Flag_is_removed_by_peephole + Flag_is_predicated_using_blend = 1 << 17, + _last_flag = Flag_is_predicated_using_blend }; class PD; @@ -931,7 +938,10 @@ public: DEFINE_CLASS_QUERY(Vector) DEFINE_CLASS_QUERY(VectorMaskCmp) DEFINE_CLASS_QUERY(VectorUnbox) - DEFINE_CLASS_QUERY(VectorReinterpret); + DEFINE_CLASS_QUERY(VectorReinterpret) + DEFINE_CLASS_QUERY(CompressV) + DEFINE_CLASS_QUERY(ExpandV) + DEFINE_CLASS_QUERY(CompressM) DEFINE_CLASS_QUERY(LoadVector) DEFINE_CLASS_QUERY(LoadVectorGather) DEFINE_CLASS_QUERY(StoreVector) @@ -989,6 +999,8 @@ public: bool is_predicated_vector() const { return (_flags & Flag_is_predicated_vector) != 0; } + bool is_predicated_using_blend() const { return (_flags & Flag_is_predicated_using_blend) != 0; } + // Used in lcm to mark nodes that have scheduled bool is_scheduled() const { return (_flags & Flag_is_scheduled) != 0; } diff --git a/src/hotspot/share/opto/subnode.hpp b/src/hotspot/share/opto/subnode.hpp index b1023fbf8da..ecd8722b2b6 100644 --- a/src/hotspot/share/opto/subnode.hpp +++ b/src/hotspot/share/opto/subnode.hpp @@ -548,4 +548,24 @@ public: virtual uint ideal_reg() const { return Op_RegI; } }; +//-------------------------------ReverseINode-------------------------------- +// reverse bits of an int +class ReverseINode : public Node { +public: + ReverseINode(Node *c, Node *in1) : Node(c, in1) {} + virtual int Opcode() const; + const Type *bottom_type() const { return TypeInt::INT; } + virtual uint ideal_reg() const { return Op_RegI; } +}; + +//-------------------------------ReverseLNode-------------------------------- +// reverse bits of a long +class ReverseLNode : public Node { +public: + ReverseLNode(Node *c, Node *in1) : Node(c, in1) {} + virtual int Opcode() const; + const Type *bottom_type() const { return TypeLong::LONG; } + virtual uint ideal_reg() const { return Op_RegL; } +}; + #endif // SHARE_OPTO_SUBNODE_HPP diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index 291b805bce8..88ca22b8718 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -2585,7 +2585,9 @@ bool SuperWord::output() { opc == Op_AbsI || opc == Op_AbsL || opc == Op_NegF || opc == Op_NegD || opc == Op_RoundF || opc == Op_RoundD || - opc == Op_PopCountI || opc == Op_PopCountL) { + opc == Op_PopCountI || opc == Op_PopCountL || + opc == Op_CountLeadingZerosI || opc == Op_CountLeadingZerosL || + opc == Op_CountTrailingZerosI || opc == Op_CountTrailingZerosL) { assert(n->req() == 2, "only one input expected"); Node* in = vector_opd(p, 1); vn = VectorNode::make(opc, in, NULL, vlen, velt_basic_type(n)); @@ -3092,9 +3094,9 @@ bool SuperWord::is_vector_use(Node* use, int u_idx) { return true; } - if (VectorNode::is_vpopcnt_long(use)) { - // VPOPCNT_LONG takes long and produces int - hence the special checks - // on alignment and size. + if (VectorNode::is_type_transition_long_to_int(use)) { + // PopCountL/CountLeadingZerosL/CountTrailingZerosL takes long and produces + // int - hence the special checks on alignment and size. if (u_pk->size() != d_pk->size()) { return false; } diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp index b4fee7f27fd..66e7b82ceeb 100644 --- a/src/hotspot/share/opto/vectorIntrinsics.cpp +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp @@ -80,9 +80,12 @@ bool LibraryCallKit::arch_supports_vector_rotate(int opc, int num_elem, BasicTyp } if (is_supported) { - // Check whether mask unboxing is supported. + // Check if mask unboxing is supported, this is a two step process which first loads the contents + // of boolean array into vector followed by either lane expansion to match the lane size of masked + // vector operation or populate the predicate register. if ((mask_use_type & VecMaskUseLoad) != 0) { - if (!Matcher::match_rule_supported_vector(Op_VectorLoadMask, num_elem, elem_bt)) { + if (!Matcher::match_rule_supported_vector(Op_VectorLoadMask, num_elem, elem_bt) || + !Matcher::match_rule_supported_vector(Op_LoadVector, num_elem, T_BOOLEAN)) { #ifndef PRODUCT if (C->print_intrinsics()) { tty->print_cr(" ** Rejected vector mask loading (%s,%s,%d) because architecture does not support it", @@ -260,9 +263,12 @@ bool LibraryCallKit::arch_supports_vector(int sopc, int num_elem, BasicType type return false; } - // Check whether mask unboxing is supported. + // Check if mask unboxing is supported, this is a two step process which first loads the contents + // of boolean array into vector followed by either lane expansion to match the lane size of masked + // vector operation or populate the predicate register. if ((mask_use_type & VecMaskUseLoad) != 0) { - if (!Matcher::match_rule_supported_vector(Op_VectorLoadMask, num_elem, type)) { + if (!Matcher::match_rule_supported_vector(Op_VectorLoadMask, num_elem, type) || + !Matcher::match_rule_supported_vector(Op_LoadVector, num_elem, T_BOOLEAN)) { #ifndef PRODUCT if (C->print_intrinsics()) { tty->print_cr(" ** Rejected vector mask loading (%s,%s,%d) because architecture does not support it", @@ -273,9 +279,12 @@ bool LibraryCallKit::arch_supports_vector(int sopc, int num_elem, BasicType type } } - // Check whether mask boxing is supported. + // Check if mask boxing is supported, this is a two step process which first stores the contents + // of mask vector / predicate register into a boolean vector followed by vector store operation to + // transfer the contents to underlined storage of mask boxes which is a boolean array. if ((mask_use_type & VecMaskUseStore) != 0) { - if (!Matcher::match_rule_supported_vector(Op_VectorStoreMask, num_elem, type)) { + if (!Matcher::match_rule_supported_vector(Op_VectorStoreMask, num_elem, type) || + !Matcher::match_rule_supported_vector(Op_StoreVector, num_elem, T_BOOLEAN)) { #ifndef PRODUCT if (C->print_intrinsics()) { tty->print_cr("Rejected vector mask storing (%s,%s,%d) because architecture does not support it", @@ -560,6 +569,7 @@ bool LibraryCallKit::inline_vector_nary_operation(int n) { operation->add_req(mask); operation->add_flag(Node::Flag_is_predicated_vector); } else { + operation->add_flag(Node::Flag_is_predicated_using_blend); operation = gvn().transform(operation); operation = new VectorBlendNode(opd1, operation, mask); } @@ -695,16 +705,8 @@ bool LibraryCallKit::inline_vector_mask_operation() { ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); BasicType elem_bt = elem_type->basic_type(); - if (!arch_supports_vector(Op_LoadVector, num_elem, T_BOOLEAN, VecMaskNotUsed)) { - if (C->print_intrinsics()) { - tty->print_cr(" ** not supported: arity=1 op=cast#%d/3 vlen2=%d etype2=%s", - Op_LoadVector, num_elem, type2name(T_BOOLEAN)); - } - return false; // not supported - } - int mopc = VectorSupport::vop2ideal(oper->get_con(), elem_bt); - if (!arch_supports_vector(mopc, num_elem, elem_bt, VecMaskNotUsed)) { + if (!arch_supports_vector(mopc, num_elem, elem_bt, VecMaskUseLoad)) { if (C->print_intrinsics()) { tty->print_cr(" ** not supported: arity=1 op=cast#%d/3 vlen2=%d etype2=%s", mopc, num_elem, type2name(elem_bt)); @@ -937,7 +939,7 @@ static bool elem_consistent_with_arr(BasicType elem_bt, const TypeAryPtr* arr_ty // S extends VectorSpecies> // VM load(Class vmClass, Class elementType, int length, // Object base, long offset, // Unsafe addressing -// C container, int index, S s, // Arguments for default implementation +// C container, long index, S s, // Arguments for default implementation // LoadOperation defaultImpl) // // public static @@ -946,7 +948,7 @@ static bool elem_consistent_with_arr(BasicType elem_bt, const TypeAryPtr* arr_ty // void store(Class vectorClass, Class elementType, int length, // Object base, long offset, // Unsafe addressing // V v, -// C container, int index, // Arguments for default implementation +// C container, long index, // Arguments for default implementation // StoreVectorOperation defaultImpl) bool LibraryCallKit::inline_vector_mem_operation(bool is_store) { @@ -1049,16 +1051,6 @@ bool LibraryCallKit::inline_vector_mem_operation(bool is_store) { } } if (is_mask) { - if (!arch_supports_vector(Op_LoadVector, num_elem, T_BOOLEAN, VecMaskNotUsed)) { - if (C->print_intrinsics()) { - tty->print_cr(" ** not supported: arity=%d op=%s/mask vlen=%d etype=bit ismask=no", - is_store, is_store ? "store" : "load", - num_elem); - } - set_map(old_map); - set_sp(old_sp); - return false; // not supported - } if (!is_store) { if (!arch_supports_vector(Op_LoadVector, num_elem, elem_bt, VecMaskUseLoad)) { set_map(old_map); @@ -1096,7 +1088,9 @@ bool LibraryCallKit::inline_vector_mem_operation(bool is_store) { const TypeVect* to_vect_type = TypeVect::make(T_BYTE, store_num_elem); val = gvn().transform(new VectorReinterpretNode(val, val->bottom_type()->is_vect(), to_vect_type)); } - + if (is_mask) { + val = gvn().transform(VectorStoreMaskNode::make(gvn(), val, elem_bt, num_elem)); + } Node* vstore = gvn().transform(StoreVectorNode::make(0, control(), memory(addr), addr, addr_type, val, store_num_elem)); set_memory(vstore, addr_type); } else { @@ -1138,7 +1132,7 @@ bool LibraryCallKit::inline_vector_mem_operation(bool is_store) { // M extends VectorMask> // V loadMasked(Class vectorClass, Class maskClass, Class elementType, // int length, Object base, long offset, M m, -// C container, int index, S s, // Arguments for default implementation +// C container, long index, S s, // Arguments for default implementation // LoadVectorMaskedOperation defaultImpl) { // // public static @@ -1149,7 +1143,7 @@ bool LibraryCallKit::inline_vector_mem_operation(bool is_store) { // void storeMasked(Class vectorClass, Class maskClass, Class elementType, // int length, Object base, long offset, // V v, M m, -// C container, int index, // Arguments for default implementation +// C container, long index, // Arguments for default implementation // StoreVectorMaskedOperation defaultImpl) { // bool LibraryCallKit::inline_vector_mem_masked_operation(bool is_store) { @@ -2736,3 +2730,97 @@ bool LibraryCallKit::inline_vector_extract() { return true; } +// public static +// , +// M extends VectorMask, +// E> +// V compressExpandOp(int opr, +// Class vClass, Class mClass, Class eClass, +// int length, V v, M m, +// CompressExpandOperation defaultImpl) +bool LibraryCallKit::inline_vector_compress_expand() { + const TypeInt* opr = gvn().type(argument(0))->isa_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* mask_klass = gvn().type(argument(2))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(3))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(4))->isa_int(); + + if (vector_klass == NULL || elem_klass == NULL || mask_klass == NULL || vlen == NULL || + vector_klass->const_oop() == NULL || mask_klass->const_oop() == NULL || + elem_klass->const_oop() == NULL || !vlen->is_con() || !opr->is_con()) { + if (C->print_intrinsics()) { + tty->print_cr(" ** missing constant: opr=%s vclass=%s mclass=%s etype=%s vlen=%s", + NodeClassNames[argument(0)->Opcode()], + NodeClassNames[argument(1)->Opcode()], + NodeClassNames[argument(2)->Opcode()], + NodeClassNames[argument(3)->Opcode()], + NodeClassNames[argument(4)->Opcode()]); + } + return false; // not enough info for intrinsification + } + + if (!is_klass_initialized(vector_klass) || !is_klass_initialized(mask_klass)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** klass argument not initialized"); + } + return false; + } + + ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); + if (!elem_type->is_primitive_type()) { + if (C->print_intrinsics()) { + tty->print_cr(" ** not a primitive bt=%d", elem_type->basic_type()); + } + return false; // should be primitive type + } + + int num_elem = vlen->get_con(); + BasicType elem_bt = elem_type->basic_type(); + int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt); + + if (!arch_supports_vector(opc, num_elem, elem_bt, VecMaskUseLoad)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** not supported: opc=%d vlen=%d etype=%s ismask=useload", + opc, num_elem, type2name(elem_bt)); + } + return false; // not supported + } + + Node* opd1 = NULL; + const TypeInstPtr* vbox_type = NULL; + if (opc != Op_CompressM) { + ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass(); + vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass); + opd1 = unbox_vector(argument(5), vbox_type, elem_bt, num_elem); + if (opd1 == NULL) { + if (C->print_intrinsics()) { + tty->print_cr(" ** unbox failed vector=%s", + NodeClassNames[argument(5)->Opcode()]); + } + return false; + } + } + + ciKlass* mbox_klass = mask_klass->const_oop()->as_instance()->java_lang_Class_klass(); + assert(is_vector_mask(mbox_klass), "argument(6) should be a mask class"); + const TypeInstPtr* mbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, mbox_klass); + + Node* mask = unbox_vector(argument(6), mbox_type, elem_bt, num_elem); + if (mask == NULL) { + if (C->print_intrinsics()) { + tty->print_cr(" ** unbox failed mask=%s", + NodeClassNames[argument(6)->Opcode()]); + } + return false; + } + + const TypeVect* vt = TypeVect::make(elem_bt, num_elem, opc == Op_CompressM); + Node* operation = gvn().transform(VectorNode::make(opc, opd1, mask, vt)); + + // Wrap it up in VectorBox to keep object type information. + const TypeInstPtr* box_type = opc == Op_CompressM ? mbox_type : vbox_type; + Node* vbox = box_vector(operation, box_type, elem_bt, num_elem); + set_result(vbox); + C->set_max_vector_size(MAX2(C->max_vector_size(), (uint)(num_elem * type2aelembytes(elem_bt)))); + return true; +} diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 5de2b3c7925..a763bdc09f9 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -162,11 +162,22 @@ int VectorNode::opcode(int sopc, BasicType bt) { case Op_RoundD: return (bt == T_LONG ? Op_RoundVD : 0); case Op_PopCountI: - // Unimplemented for subword types since bit count changes - // depending on size of lane (and sign bit). - return (bt == T_INT ? Op_PopCountVI : 0); + return Op_PopCountVI; case Op_PopCountL: return Op_PopCountVL; + case Op_ReverseI: + case Op_ReverseL: + return (is_integral_type(bt) ? Op_ReverseV : 0); + case Op_ReverseBytesS: + case Op_ReverseBytesI: + case Op_ReverseBytesL: + return (is_integral_type(bt) ? Op_ReverseBytesV : 0); + case Op_CompressBits: + // Not implemented. Returning 0 temporarily + return 0; + case Op_ExpandBits: + // Not implemented. Returning 0 temporarily + return 0; case Op_LShiftI: switch (bt) { case T_BOOLEAN: @@ -245,6 +256,12 @@ int VectorNode::opcode(int sopc, BasicType bt) { return Op_VectorCastF2X; case Op_ConvD2L: return Op_VectorCastD2X; + case Op_CountLeadingZerosI: + case Op_CountLeadingZerosL: + return Op_CountLeadingZerosV; + case Op_CountTrailingZerosI: + case Op_CountTrailingZerosL: + return Op_CountTrailingZerosV; case Op_SignumF: return Op_SignumVF; case Op_SignumD: @@ -317,16 +334,17 @@ bool VectorNode::is_muladds2i(Node* n) { return false; } -bool VectorNode::is_vpopcnt_long(Node* n) { - if (n->Opcode() == Op_PopCountL) { - return true; +bool VectorNode::is_type_transition_long_to_int(Node* n) { + switch(n->Opcode()) { + case Op_PopCountL: + case Op_CountLeadingZerosL: + case Op_CountTrailingZerosL: + return true; + default: + return false; } - return false; } - - - bool VectorNode::is_roundopD(Node* n) { if (n->Opcode() == Op_RoundDoubleMode) { return true; @@ -595,6 +613,9 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b case Op_NegVF: return new NegVFNode(n1, vt); case Op_NegVD: return new NegVDNode(n1, vt); + case Op_ReverseV: return new ReverseVNode(n1, vt); + case Op_ReverseBytesV: return new ReverseBytesVNode(n1, vt); + case Op_SqrtVF: return new SqrtVFNode(n1, vt); case Op_SqrtVD: return new SqrtVDNode(n1, vt); @@ -628,6 +649,12 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b case Op_RoundDoubleModeV: return new RoundDoubleModeVNode(n1, n2, vt); case Op_MulAddVS2VI: return new MulAddVS2VINode(n1, n2, vt); + + case Op_ExpandV: return new ExpandVNode(n1, n2, vt); + case Op_CompressV: return new CompressVNode(n1, n2, vt); + case Op_CompressM: assert(n1 == NULL, ""); return new CompressMNode(n2, vt); + case Op_CountLeadingZerosV: return new CountLeadingZerosVNode(n1, vt); + case Op_CountTrailingZerosV: return new CountTrailingZerosVNode(n1, vt); default: fatal("Missed vector creation for '%s'", NodeClassNames[vopc]); return NULL; @@ -1669,6 +1696,38 @@ Node* NegVNode::Ideal(PhaseGVN* phase, bool can_reshape) { return NULL; } +Node* ReverseBytesVNode::Identity(PhaseGVN* phase) { + if (is_predicated_using_blend()) { + return this; + } + // ReverseBytesV (ReverseBytesV X , MASK) , MASK => X + if (in(1)->Opcode() == Op_ReverseBytesV) { + if (is_predicated_vector() && in(1)->is_predicated_vector() && in(2) == in(1)->in(2)) { + return in(1)->in(1); + } else { + // ReverseBytesV (ReverseBytesV X) => X + return in(1)->in(1); + } + } + return this; +} + +Node* ReverseVNode::Identity(PhaseGVN* phase) { + if (is_predicated_using_blend()) { + return this; + } + // ReverseV (ReverseV X , MASK) , MASK => X + if (in(1)->Opcode() == Op_ReverseV) { + if (is_predicated_vector() && in(1)->is_predicated_vector() && in(2) == in(1)->in(2)) { + return in(1)->in(1); + } else { + // ReverseV (ReverseV X) => X + return in(1)->in(1); + } + } + return this; +} + #ifndef PRODUCT void VectorBoxAllocateNode::dump_spec(outputStream *st) const { CallStaticJavaNode::dump_spec(st); diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index 341da301722..360847e95c9 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -93,7 +93,7 @@ class VectorNode : public TypeNode { static bool is_type_transition_short_to_int(Node* n); static bool is_type_transition_to_int(Node* n); static bool is_muladds2i(Node* n); - static bool is_vpopcnt_long(Node* n); + static bool is_type_transition_long_to_int(Node* n); static bool is_roundopD(Node* n); static bool is_scalar_rotate(Node* n); static bool is_vector_rotate_supported(int opc, uint vlen, BasicType bt); @@ -769,6 +769,37 @@ public: virtual int Opcode() const; }; +//------------------------------CompressVNode-------------------------------------- +// Vector compress +class CompressVNode: public VectorNode { + public: + CompressVNode(Node* vec, Node* mask, const TypeVect* vt) : + VectorNode(vec, mask, vt) { + init_class_id(Class_CompressV); + } + virtual int Opcode() const; +}; + +class CompressMNode: public VectorNode { + public: + CompressMNode(Node* mask, const TypeVect* vt) : + VectorNode(mask, vt) { + init_class_id(Class_CompressM); + } + virtual int Opcode() const; +}; + +//------------------------------ExpandVNode-------------------------------------- +// Vector expand +class ExpandVNode: public VectorNode { + public: + ExpandVNode(Node* vec, Node* mask, const TypeVect* vt) : + VectorNode(vec, mask, vt) { + init_class_id(Class_ExpandV); + } + virtual int Opcode() const; +}; + //================================= M E M O R Y =============================== //------------------------------LoadVectorNode--------------------------------- @@ -1392,7 +1423,6 @@ class VectorBlendNode : public VectorNode { public: VectorBlendNode(Node* vec1, Node* vec2, Node* mask) : VectorNode(vec1, vec2, mask, vec1->bottom_type()->is_vect()) { - // assert(mask->is_VectorMask(), "VectorBlendNode requires that third argument be a mask"); } virtual int Opcode() const; @@ -1675,6 +1705,40 @@ public: Node* Ideal(PhaseGVN* phase, bool can_reshape); }; +class CountLeadingZerosVNode : public VectorNode { + public: + CountLeadingZerosVNode(Node* in, const TypeVect* vt) + : VectorNode(in, vt) {} + + virtual int Opcode() const; +}; + +class CountTrailingZerosVNode : public VectorNode { + public: + CountTrailingZerosVNode(Node* in, const TypeVect* vt) + : VectorNode(in, vt) {} + + virtual int Opcode() const; +}; + +class ReverseVNode : public VectorNode { +public: + ReverseVNode(Node* in, const TypeVect* vt) + : VectorNode(in, vt) {} + + virtual Node* Identity(PhaseGVN* phase); + virtual int Opcode() const; +}; + +class ReverseBytesVNode : public VectorNode { +public: + ReverseBytesVNode(Node* in, const TypeVect* vt) + : VectorNode(in, vt) {} + + virtual Node* Identity(PhaseGVN* phase); + virtual int Opcode() const; +}; + class SignumVFNode : public VectorNode { public: SignumVFNode(Node* in1, Node* zero, Node* one, const TypeVect* vt) @@ -1690,4 +1754,5 @@ public: virtual int Opcode() const; }; + #endif // SHARE_OPTO_VECTORNODE_HPP diff --git a/src/hotspot/share/prims/vectorSupport.cpp b/src/hotspot/share/prims/vectorSupport.cpp index 59d8003db66..e87e739589d 100644 --- a/src/hotspot/share/prims/vectorSupport.cpp +++ b/src/hotspot/share/prims/vectorSupport.cpp @@ -443,6 +443,109 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) { } break; } + case VECTOR_OP_EXPAND: { + switch (bt) { + case T_BYTE: // fall-through + case T_SHORT: // fall-through + case T_INT: // fall-through + case T_LONG: // fall-through + case T_FLOAT: // fall-through + case T_DOUBLE: return Op_ExpandV; + default: fatal("EXPAND: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_COMPRESS: { + switch (bt) { + case T_BYTE: // fall-through + case T_SHORT: // fall-through + case T_INT: // fall-through + case T_LONG: // fall-through + case T_FLOAT: // fall-through + case T_DOUBLE: return Op_CompressV; + default: fatal("COMPRESS: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_MASK_COMPRESS: { + switch (bt) { + case T_BYTE: // fall-through + case T_SHORT: // fall-through + case T_INT: // fall-through + case T_LONG: // fall-through + case T_FLOAT: // fall-through + case T_DOUBLE: return Op_CompressM; + default: fatal("MASK_COMPRESS: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_BIT_COUNT: { + switch (bt) { + case T_BYTE: // Returning Op_PopCountI + case T_SHORT: // for byte and short types temporarily + case T_INT: return Op_PopCountI; + case T_LONG: return Op_PopCountL; + default: fatal("BIT_COUNT: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_TZ_COUNT: { + switch (bt) { + case T_BYTE: + case T_SHORT: + case T_INT: return Op_CountTrailingZerosI; + case T_LONG: return Op_CountTrailingZerosL; + default: fatal("TZ_COUNT: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_LZ_COUNT: { + switch (bt) { + case T_BYTE: + case T_SHORT: + case T_INT: return Op_CountLeadingZerosI; + case T_LONG: return Op_CountLeadingZerosL; + default: fatal("LZ_COUNT: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_REVERSE: { + switch (bt) { + case T_BYTE: // Temporarily returning + case T_SHORT: // Op_ReverseI for byte and short + case T_INT: return Op_ReverseI; + case T_LONG: return Op_ReverseL; + default: fatal("REVERSE: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_REVERSE_BYTES: { + switch (bt) { + case T_BYTE: + case T_SHORT: + case T_INT: return Op_ReverseBytesI; + case T_LONG: return Op_ReverseBytesL; + default: fatal("REVERSE_BYTES: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_COMPRESS_BITS: { + switch (bt) { + case T_INT: + case T_LONG: return Op_CompressBits; + default: fatal("COMPRESS_BITS: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_EXPAND_BITS: { + switch (bt) { + case T_INT: + case T_LONG: return Op_ExpandBits; + default: fatal("EXPAND_BITS: %s", type2name(bt)); + } + break; + } + case VECTOR_OP_TAN: case VECTOR_OP_TANH: case VECTOR_OP_SIN: diff --git a/src/hotspot/share/prims/vectorSupport.hpp b/src/hotspot/share/prims/vectorSupport.hpp index 1a43aacddda..46dde49bd7f 100644 --- a/src/hotspot/share/prims/vectorSupport.hpp +++ b/src/hotspot/share/prims/vectorSupport.hpp @@ -54,6 +54,7 @@ class VectorSupport : AllStatic { VECTOR_OP_ABS = 0, VECTOR_OP_NEG = 1, VECTOR_OP_SQRT = 2, + VECTOR_OP_BIT_COUNT = 3, // Binary VECTOR_OP_ADD = 4, @@ -89,6 +90,17 @@ class VectorSupport : AllStatic { VECTOR_OP_LROTATE = 24, VECTOR_OP_RROTATE = 25, + VECTOR_OP_COMPRESS = 26, + VECTOR_OP_EXPAND = 27, + VECTOR_OP_MASK_COMPRESS = 28, + + VECTOR_OP_TZ_COUNT = 29, + VECTOR_OP_LZ_COUNT = 30, + VECTOR_OP_REVERSE = 31, + VECTOR_OP_REVERSE_BYTES = 32, + VECTOR_OP_COMPRESS_BITS = 33, + VECTOR_OP_EXPAND_BITS = 34, + // Vector Math Library VECTOR_OP_TAN = 101, VECTOR_OP_TANH = 102, diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 147126f14ad..b007c3d488f 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -1775,6 +1775,9 @@ declare_c2_type(FmaVFNode, VectorNode) \ declare_c2_type(CMoveVFNode, VectorNode) \ declare_c2_type(CMoveVDNode, VectorNode) \ + declare_c2_type(CompressVNode, VectorNode) \ + declare_c2_type(CompressMNode, VectorNode) \ + declare_c2_type(ExpandVNode, VectorNode) \ declare_c2_type(MulReductionVDNode, ReductionNode) \ declare_c2_type(DivVFNode, VectorNode) \ declare_c2_type(DivVDNode, VectorNode) \ @@ -1866,6 +1869,10 @@ declare_c2_type(VectorUnboxNode, VectorNode) \ declare_c2_type(VectorReinterpretNode, VectorNode) \ declare_c2_type(VectorMaskCastNode, VectorNode) \ + declare_c2_type(CountLeadingZerosVNode, VectorNode) \ + declare_c2_type(CountTrailingZerosVNode, VectorNode) \ + declare_c2_type(ReverseBytesVNode, VectorNode) \ + declare_c2_type(ReverseVNode, VectorNode) \ declare_c2_type(MaskAllNode, VectorNode) \ declare_c2_type(AndVMaskNode, VectorNode) \ declare_c2_type(OrVMaskNode, VectorNode) \ diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index a0a87ea28b8..50b219b9280 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -721,6 +721,10 @@ inline bool is_integral_type(BasicType t) { return is_subword_type(t) || t == T_INT || t == T_LONG; } +inline bool is_non_subword_integral_type(BasicType t) { + return t == T_INT || t == T_LONG; +} + inline bool is_floating_point_type(BasicType t) { return (t == T_FLOAT || t == T_DOUBLE); } diff --git a/src/java.base/share/classes/jdk/internal/misc/X-ScopedMemoryAccess.java.template b/src/java.base/share/classes/jdk/internal/misc/X-ScopedMemoryAccess.java.template index 2ce8a115898..d3d0c2a18b6 100644 --- a/src/java.base/share/classes/jdk/internal/misc/X-ScopedMemoryAccess.java.template +++ b/src/java.base/share/classes/jdk/internal/misc/X-ScopedMemoryAccess.java.template @@ -32,8 +32,6 @@ import java.lang.annotation.Target; import java.lang.foreign.MemorySegment; import java.lang.ref.Reference; import java.io.FileDescriptor; -import java.nio.Buffer; -import java.nio.ByteBuffer; import jdk.internal.access.JavaNioAccess; import jdk.internal.access.SharedSecrets; @@ -313,59 +311,25 @@ public class ScopedMemoryAccess { } } - // ByteBuffer vector access ops - - // Buffer access constants, to be initialized when required. - // Avoids a null value for NIO_ACCESS, due to class initialization dependencies - static final class BufferAccess { - // Buffer.address - static final long BUFFER_ADDRESS - = UNSAFE.objectFieldOffset(Buffer.class, "address"); - - // ByteBuffer.hb - static final long BYTE_BUFFER_HB - = UNSAFE.objectFieldOffset(ByteBuffer.class, "hb"); - - static final long BYTE_BUFFER_IS_READ_ONLY - = UNSAFE.objectFieldOffset(ByteBuffer.class, "isReadOnly"); - - @ForceInline - static Object bufferBase(ByteBuffer bb) { - return UNSAFE.getReference(bb, BYTE_BUFFER_HB); - } - - @ForceInline - static long bufferAddress(ByteBuffer bb, long offset) { - return UNSAFE.getLong(bb, BUFFER_ADDRESS) + offset; - } - - static final JavaNioAccess NIO_ACCESS = SharedSecrets.getJavaNioAccess(); - - @ForceInline - static MemorySessionImpl session(ByteBuffer bb) { - MemorySegment segment = NIO_ACCESS.bufferSegment(bb); - return segment != null ? - ((AbstractMemorySegmentImpl)segment).sessionImpl() : null; - } - } - - @ForceInline - public static boolean isReadOnly(ByteBuffer bb) { - return UNSAFE.getBoolean(bb, BufferAccess.BYTE_BUFFER_IS_READ_ONLY); - } + // MemorySegment vector access ops @ForceInline public static , E, S extends VectorSupport.VectorSpecies> - V loadFromByteBuffer(Class vmClass, Class e, int length, - ByteBuffer bb, int offset, - S s, - VectorSupport.LoadOperation defaultImpl) { + V loadFromMemorySegment(Class vmClass, Class e, int length, + AbstractMemorySegmentImpl msp, long offset, + S s, + VectorSupport.LoadOperation defaultImpl) { + // @@@ Smarter alignment checking if accessing heap segment backing non-byte[] array + if (msp.maxAlignMask() > 1) { + throw new IllegalArgumentException(); + } + try { - return loadFromByteBufferScoped( - BufferAccess.session(bb), + return loadFromMemorySegmentScopedInternal( + msp.sessionImpl(), vmClass, e, length, - bb, offset, + msp, offset, s, defaultImpl); } catch (ScopedAccessError ex) { @@ -377,22 +341,18 @@ public class ScopedMemoryAccess { @ForceInline private static , E, S extends VectorSupport.VectorSpecies> - V loadFromByteBufferScoped(MemorySessionImpl session, - Class vmClass, Class e, int length, - ByteBuffer bb, int offset, - S s, - VectorSupport.LoadOperation defaultImpl) { + V loadFromMemorySegmentScopedInternal(MemorySessionImpl session, + Class vmClass, Class e, int length, + AbstractMemorySegmentImpl msp, long offset, + S s, + VectorSupport.LoadOperation defaultImpl) { try { - if (session != null) { - session.checkValidState(); - } - - final byte[] base = (byte[]) BufferAccess.bufferBase(bb); + session.checkValidState(); return VectorSupport.load(vmClass, e, length, - base, BufferAccess.bufferAddress(bb, offset), - bb, offset, s, - defaultImpl); + msp.unsafeGetBase(), msp.unsafeGetOffset() + offset, + msp, offset, s, + defaultImpl); } finally { Reference.reachabilityFence(session); } @@ -402,17 +362,22 @@ public class ScopedMemoryAccess { public static , E, S extends VectorSupport.VectorSpecies, M extends VectorSupport.VectorMask> - V loadFromByteBufferMasked(Class vmClass, Class maskClass, Class e, - int length, ByteBuffer bb, int offset, M m, S s, - VectorSupport.LoadVectorMaskedOperation defaultImpl) { + V loadFromMemorySegmentMasked(Class vmClass, Class maskClass, Class e, + int length, AbstractMemorySegmentImpl msp, long offset, M m, S s, + VectorSupport.LoadVectorMaskedOperation defaultImpl) { + // @@@ Smarter alignment checking if accessing heap segment backing non-byte[] array + if (msp.maxAlignMask() > 1) { + throw new IllegalArgumentException(); + } + try { - return loadFromByteBufferMaskedScoped( - BufferAccess.session(bb), + return loadFromMemorySegmentMaskedScopedInternal( + msp.sessionImpl(), vmClass, maskClass, e, length, - bb, offset, m, + msp, offset, m, s, defaultImpl); - } catch (ScopedMemoryAccess.ScopedAccessError ex) { + } catch (ScopedAccessError ex) { throw new IllegalStateException("This segment is already closed"); } } @@ -422,19 +387,17 @@ public class ScopedMemoryAccess { private static , E, S extends VectorSupport.VectorSpecies, M extends VectorSupport.VectorMask> - V loadFromByteBufferMaskedScoped(MemorySessionImpl session, Class vmClass, - Class maskClass, Class e, int length, - ByteBuffer bb, int offset, M m, - S s, - VectorSupport.LoadVectorMaskedOperation defaultImpl) { + V loadFromMemorySegmentMaskedScopedInternal(MemorySessionImpl session, Class vmClass, + Class maskClass, Class e, int length, + AbstractMemorySegmentImpl msp, long offset, M m, + S s, + VectorSupport.LoadVectorMaskedOperation defaultImpl) { try { - if (session != null) { - session.checkValidState(); - } + session.checkValidState(); return VectorSupport.loadMasked(vmClass, maskClass, e, length, - BufferAccess.bufferBase(bb), BufferAccess.bufferAddress(bb, offset), m, - bb, offset, s, + msp.unsafeGetBase(), msp.unsafeGetOffset() + offset, m, + msp, offset, s, defaultImpl); } finally { Reference.reachabilityFence(session); @@ -444,16 +407,21 @@ public class ScopedMemoryAccess { @ForceInline public static , E> - void storeIntoByteBuffer(Class vmClass, Class e, int length, - V v, - ByteBuffer bb, int offset, - VectorSupport.StoreVectorOperation defaultImpl) { + void storeIntoMemorySegment(Class vmClass, Class e, int length, + V v, + AbstractMemorySegmentImpl msp, long offset, + VectorSupport.StoreVectorOperation defaultImpl) { + // @@@ Smarter alignment checking if accessing heap segment backing non-byte[] array + if (msp.maxAlignMask() > 1) { + throw new IllegalArgumentException(); + } + try { - storeIntoByteBufferScoped( - BufferAccess.session(bb), + storeIntoMemorySegmentScopedInternal( + msp.sessionImpl(), vmClass, e, length, v, - bb, offset, + msp, offset, defaultImpl); } catch (ScopedAccessError ex) { throw new IllegalStateException("This segment is already closed"); @@ -464,23 +432,19 @@ public class ScopedMemoryAccess { @ForceInline private static , E> - void storeIntoByteBufferScoped(MemorySessionImpl session, - Class vmClass, Class e, int length, - V v, - ByteBuffer bb, int offset, - VectorSupport.StoreVectorOperation defaultImpl) { + void storeIntoMemorySegmentScopedInternal(MemorySessionImpl session, + Class vmClass, Class e, int length, + V v, + AbstractMemorySegmentImpl msp, long offset, + VectorSupport.StoreVectorOperation defaultImpl) { try { - if (session != null) { - session.checkValidState(); - } - - final byte[] base = (byte[]) BufferAccess.bufferBase(bb); + session.checkValidState(); VectorSupport.store(vmClass, e, length, - base, BufferAccess.bufferAddress(bb, offset), - v, - bb, offset, - defaultImpl); + msp.unsafeGetBase(), msp.unsafeGetOffset() + offset, + v, + msp, offset, + defaultImpl); } finally { Reference.reachabilityFence(session); } @@ -489,18 +453,23 @@ public class ScopedMemoryAccess { @ForceInline public static , E, M extends VectorSupport.VectorMask> - void storeIntoByteBufferMasked(Class vmClass, Class maskClass, Class e, - int length, V v, M m, - ByteBuffer bb, int offset, - VectorSupport.StoreVectorMaskedOperation defaultImpl) { + void storeIntoMemorySegmentMasked(Class vmClass, Class maskClass, Class e, + int length, V v, M m, + AbstractMemorySegmentImpl msp, long offset, + VectorSupport.StoreVectorMaskedOperation defaultImpl) { + // @@@ Smarter alignment checking if accessing heap segment backing non-byte[] array + if (msp.maxAlignMask() > 1) { + throw new IllegalArgumentException(); + } + try { - storeIntoByteBufferMaskedScoped( - BufferAccess.session(bb), + storeIntoMemorySegmentMaskedScopedInternal( + msp.sessionImpl(), vmClass, maskClass, e, length, v, m, - bb, offset, + msp, offset, defaultImpl); - } catch (ScopedMemoryAccess.ScopedAccessError ex) { + } catch (ScopedAccessError ex) { throw new IllegalStateException("This segment is already closed"); } } @@ -509,20 +478,18 @@ public class ScopedMemoryAccess { @ForceInline private static , E, M extends VectorSupport.VectorMask> - void storeIntoByteBufferMaskedScoped(MemorySessionImpl session, - Class vmClass, Class maskClass, - Class e, int length, V v, M m, - ByteBuffer bb, int offset, - VectorSupport.StoreVectorMaskedOperation defaultImpl) { + void storeIntoMemorySegmentMaskedScopedInternal(MemorySessionImpl session, + Class vmClass, Class maskClass, + Class e, int length, V v, M m, + AbstractMemorySegmentImpl msp, long offset, + VectorSupport.StoreVectorMaskedOperation defaultImpl) { try { - if (session != null) { - session.checkValidState(); - } + session.checkValidState(); VectorSupport.storeMasked(vmClass, maskClass, e, length, - BufferAccess.bufferBase(bb), BufferAccess.bufferAddress(bb, offset), + msp.unsafeGetBase(), msp.unsafeGetOffset() + offset, v, m, - bb, offset, + msp, offset, defaultImpl); } finally { Reference.reachabilityFence(session); diff --git a/src/java.base/share/classes/jdk/internal/vm/vector/VectorSupport.java b/src/java.base/share/classes/jdk/internal/vm/vector/VectorSupport.java index 13d75662ab6..545d635c4af 100644 --- a/src/java.base/share/classes/jdk/internal/vm/vector/VectorSupport.java +++ b/src/java.base/share/classes/jdk/internal/vm/vector/VectorSupport.java @@ -41,6 +41,7 @@ public class VectorSupport { public static final int VECTOR_OP_ABS = 0; public static final int VECTOR_OP_NEG = 1; public static final int VECTOR_OP_SQRT = 2; + public static final int VECTOR_OP_BIT_COUNT = 3; // Binary public static final int VECTOR_OP_ADD = 4; @@ -76,6 +77,23 @@ public class VectorSupport { public static final int VECTOR_OP_LROTATE = 24; public static final int VECTOR_OP_RROTATE = 25; + // Compression expansion operations + public static final int VECTOR_OP_COMPRESS = 26; + public static final int VECTOR_OP_EXPAND = 27; + public static final int VECTOR_OP_MASK_COMPRESS = 28; + + // Leading/Trailing zeros count operations + public static final int VECTOR_OP_TZ_COUNT = 29; + public static final int VECTOR_OP_LZ_COUNT = 30; + + // Reverse operation + public static final int VECTOR_OP_REVERSE = 31; + public static final int VECTOR_OP_REVERSE_BYTES = 32; + + // Compress and Expand Bits operation + public static final int VECTOR_OP_COMPRESS_BITS = 33; + public static final int VECTOR_OP_EXPAND_BITS = 34; + // Math routines public static final int VECTOR_OP_TAN = 101; public static final int VECTOR_OP_TANH = 102; @@ -363,7 +381,7 @@ public class VectorSupport { public interface LoadOperation> { - VM load(C container, int index, S s); + VM load(C container, long index, S s); } @IntrinsicCandidate @@ -375,7 +393,7 @@ public class VectorSupport { VM load(Class vmClass, Class eClass, int length, Object base, long offset, - C container, int index, S s, + C container, long index, S s, LoadOperation defaultImpl) { assert isNonCapturingLambda(defaultImpl) : defaultImpl; return defaultImpl.load(container, index, s); @@ -387,7 +405,7 @@ public class VectorSupport { V extends Vector, S extends VectorSpecies, M extends VectorMask> { - V load(C container, int index, S s, M m); + V load(C container, long index, S s, M m); } @IntrinsicCandidate @@ -400,7 +418,7 @@ public class VectorSupport { V loadMasked(Class vClass, Class mClass, Class eClass, int length, Object base, long offset, - M m, C container, int index, S s, + M m, C container, long index, S s, LoadVectorMaskedOperation defaultImpl) { assert isNonCapturingLambda(defaultImpl) : defaultImpl; return defaultImpl.load(container, index, s, m); @@ -437,18 +455,18 @@ public class VectorSupport { /* ============================================================================ */ public interface StoreVectorOperation> { - void store(C container, int index, V v); + V extends VectorPayload> { + void store(C container, long index, V v); } @IntrinsicCandidate public static > + V extends VectorPayload> void store(Class vClass, Class eClass, int length, Object base, long offset, - V v, C container, int index, + V v, C container, long index, StoreVectorOperation defaultImpl) { assert isNonCapturingLambda(defaultImpl) : defaultImpl; defaultImpl.store(container, index, v); @@ -457,7 +475,7 @@ public class VectorSupport { public interface StoreVectorMaskedOperation, M extends VectorMask> { - void store(C container, int index, V v, M m); + void store(C container, long index, V v, M m); } @IntrinsicCandidate @@ -469,7 +487,7 @@ public class VectorSupport { void storeMasked(Class vClass, Class mClass, Class eClass, int length, Object base, long offset, - V v, M m, C container, int index, + V v, M m, C container, long index, StoreVectorMaskedOperation defaultImpl) { assert isNonCapturingLambda(defaultImpl) : defaultImpl; defaultImpl.store(container, index, v, m); @@ -626,6 +644,26 @@ public class VectorSupport { /* ============================================================================ */ + public interface CompressExpandOperation, + M extends VectorMask> { + VectorPayload apply(V v, M m); + } + + @IntrinsicCandidate + public static + , + M extends VectorMask, + E> + VectorPayload compressExpandOp(int opr, + Class vClass, Class mClass, Class eClass, + int length, V v, M m, + CompressExpandOperation defaultImpl) { + assert isNonCapturingLambda(defaultImpl) : defaultImpl; + return defaultImpl.apply(v, m); + } + + /* ============================================================================ */ + @IntrinsicCandidate public static diff --git a/src/java.base/share/classes/module-info.java b/src/java.base/share/classes/module-info.java index 360ee062657..0dc3666ae4e 100644 --- a/src/java.base/share/classes/module-info.java +++ b/src/java.base/share/classes/module-info.java @@ -158,6 +158,8 @@ module java.base { jdk.jartool, jdk.jlink, jdk.net; + exports jdk.internal.foreign to + jdk.incubator.vector; exports jdk.internal.event to jdk.jfr; exports jdk.internal.jimage to diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java index cc14d150325..3437f32ceea 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java @@ -38,6 +38,7 @@ import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition; import com.sun.tools.javac.util.JCDiagnostic.Warning; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.MandatoryWarningHandler; +import com.sun.tools.javac.util.Names; import com.sun.tools.javac.util.Options; import javax.tools.JavaFileObject; @@ -78,6 +79,7 @@ public class Preview { private final Set sourcesWithPreviewFeatures = new HashSet<>(); + private final Names names; private final Lint lint; private final Log log; private final Source source; @@ -95,6 +97,7 @@ public class Preview { Preview(Context context) { context.put(previewKey, this); Options options = Options.instance(context); + names = Names.instance(context); enabled = options.isSet(PREVIEW); log = Log.instance(context); lint = Lint.instance(context); @@ -115,7 +118,22 @@ public class Preview { } } return majorVersionToSource; - } + } + + /** + * Returns true if {@code s} is deemed to participate in the preview of {@code previewSymbol}, and + * therefore no warnings or errors will be produced. + * + * @param s the symbol depending on the preview symbol + * @param previewSymbol the preview symbol marked with @Preview + * @return true if {@code s} is participating in the preview of {@code previewSymbol} + */ + public boolean participatesInPreview(Symbol s, Symbol previewSymbol) { + // Hardcode the incubating vector API module for now + // Will generalize with an annotation, @PreviewParticipating say, later + return previewSymbol.packge().modle == s.packge().modle || + s.packge().modle.name == names.jdk_incubator_vector; + } /** * Report usage of a preview feature. Usages reported through this method will affect the diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index 31927e5dcc8..16386fe804d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -3600,7 +3600,7 @@ public class Check { } void checkPreview(DiagnosticPosition pos, Symbol other, Symbol s) { - if ((s.flags() & PREVIEW_API) != 0 && s.packge().modle != other.packge().modle) { + if ((s.flags() & PREVIEW_API) != 0 && !preview.participatesInPreview(other, s)) { if ((s.flags() & PREVIEW_REFLECTIVE) == 0) { if (!preview.isEnabled()) { log.error(pos, Errors.IsPreview(s)); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java index b78de28abb4..735021d2afe 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java @@ -124,6 +124,7 @@ public class Names { // module names public final Name java_base; public final Name jdk_unsupported; + public final Name jdk_incubator_vector; // attribute names public final Name Annotation; @@ -305,6 +306,7 @@ public class Names { // module names java_base = fromString("java.base"); jdk_unsupported = fromString("jdk.unsupported"); + jdk_incubator_vector = fromString("jdk.incubator.vector"); // attribute names Annotation = fromString("Annotation"); diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java index f12778abf83..378cf70552d 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java @@ -28,6 +28,10 @@ import java.util.Objects; import jdk.internal.vm.annotation.ForceInline; +import jdk.internal.misc.Unsafe; + +import jdk.internal.vm.vector.VectorSupport; + import static jdk.incubator.vector.VectorOperators.*; abstract class AbstractMask extends VectorMask { @@ -77,7 +81,15 @@ abstract class AbstractMask extends VectorMask { @Override public void intoArray(boolean[] bits, int i) { - System.arraycopy(getBits(), 0, bits, i, length()); + AbstractSpecies vsp = (AbstractSpecies) vectorSpecies(); + int laneCount = vsp.laneCount(); + i = VectorIntrinsics.checkFromIndexSize(i, laneCount, bits.length); + VectorSupport.store( + vsp.maskType(), vsp.elementType(), laneCount, + bits, (long) i + Unsafe.ARRAY_BOOLEAN_BASE_OFFSET, + this, bits, i, + (c, idx, s) -> System.arraycopy(s.getBits(), 0, c, (int) idx, s.length())); + } @Override @@ -192,6 +204,15 @@ abstract class AbstractMask extends VectorMask { return this.andNot(badMask); } + @Override + @ForceInline + public VectorMask indexInRange(long offset, long limit) { + int vlength = length(); + Vector iota = vectorSpecies().zero().addIndex(1); + VectorMask badMask = checkIndex0(offset, limit, iota, vlength); + return this.andNot(badMask); + } + /*package-private*/ @ForceInline AbstractVector @@ -215,7 +236,7 @@ abstract class AbstractMask extends VectorMask { */ /*package-private*/ @ForceInline - void checkIndexByLane(int offset, int alength, + void checkIndexByLane(int offset, int length, Vector iota, int esize) { if (VectorIntrinsics.VECTOR_ACCESS_OOB_CHECK == 0) { @@ -229,15 +250,15 @@ abstract class AbstractMask extends VectorMask { int vlength = length(); VectorMask badMask; if (esize == 1) { - badMask = checkIndex0(offset, alength, iota, vlength); + badMask = checkIndex0(offset, length, iota, vlength); } else if (offset >= 0) { // Masked access to multi-byte lanes in byte array. // It could be aligned anywhere. - int elemCount = Math.min(vlength, (alength - offset) / esize); + int elemCount = Math.min(vlength, (length - offset) / esize); badMask = checkIndex0(0, elemCount, iota, vlength); } else { int clipOffset = Math.max(offset, -(vlength * esize)); - badMask = checkIndex0(clipOffset, alength, + badMask = checkIndex0(clipOffset, length, iota.lanewise(VectorOperators.MUL, esize), vlength * esize); } @@ -245,20 +266,20 @@ abstract class AbstractMask extends VectorMask { if (badMask.anyTrue()) { int badLane = badMask.firstTrue(); throw ((AbstractMask)badMask) - .checkIndexFailed(offset, badLane, alength, esize); + .checkIndexFailed(offset, badLane, length, esize); } } private @ForceInline - VectorMask checkIndex0(int offset, int alength, + VectorMask checkIndex0(int offset, int length, Vector iota, int vlength) { // An active lane is bad if its number is greater than - // alength-offset, since when added to offset it will step off + // length-offset, since when added to offset it will step off // of the end of the array. To avoid overflow when // converting, clip the comparison value to [0..vlength] // inclusive. - int indexLimit = Math.max(0, Math.min(alength - offset, vlength)); + int indexLimit = Math.max(0, Math.min(length - offset, vlength)); VectorMask badMask = iota.compare(GE, iota.broadcast(indexLimit)); if (offset < 0) { @@ -280,14 +301,90 @@ abstract class AbstractMask extends VectorMask { return badMask; } - private IndexOutOfBoundsException checkIndexFailed(int offset, int lane, - int alength, int esize) { + /** + * Test if a masked memory access at a given offset into an array + * of the given length will stay within the array. + * The per-lane offsets are iota*esize. + */ + /*package-private*/ + @ForceInline + void checkIndexByLane(long offset, long length, + Vector iota, + int esize) { + if (VectorIntrinsics.VECTOR_ACCESS_OOB_CHECK == 0) { + return; + } + // Although the specification is simple, the implementation is + // tricky, because the value iota*esize might possibly + // overflow. So we calculate our test values as scalars, + // clipping to the range [-1..VLENGTH], and test them against + // the unscaled iota vector, whose values are in [0..VLENGTH-1]. + int vlength = length(); + VectorMask badMask; + if (esize == 1) { + badMask = checkIndex0(offset, length, iota, vlength); + } else if (offset >= 0) { + // Masked access to multi-byte lanes in byte array. + // It could be aligned anywhere. + // 0 <= elemCount <= vlength + int elemCount = (int) Math.min(vlength, (length - offset) / esize); + badMask = checkIndex0(0, elemCount, iota, vlength); + } else { + // -vlength * esize <= clipOffset <= 0 + int clipOffset = (int) Math.max(offset, -(vlength * esize)); + badMask = checkIndex0(clipOffset, length, + iota.lanewise(VectorOperators.MUL, esize), + vlength * esize); + } + badMask = badMask.and(this); + if (badMask.anyTrue()) { + int badLane = badMask.firstTrue(); + throw ((AbstractMask)badMask) + .checkIndexFailed(offset, badLane, length, esize); + } + } + + private + @ForceInline + VectorMask checkIndex0(long offset, long length, + Vector iota, int vlength) { + // An active lane is bad if its number is greater than + // length-offset, since when added to offset it will step off + // of the end of the array. To avoid overflow when + // converting, clip the comparison value to [0..vlength] + // inclusive. + // 0 <= indexLimit <= vlength + int indexLimit = (int) Math.max(0, Math.min(length - offset, vlength)); + VectorMask badMask = + iota.compare(GE, iota.broadcast(indexLimit)); + if (offset < 0) { + // An active lane is bad if its number is less than + // -offset, because when added to offset it will then + // address an array element at a negative index. To avoid + // overflow when converting, clip the comparison value at + // vlength. This specific expression works correctly even + // when offset is Integer.MIN_VALUE. + // 0 <= firstGoodIndex <= vlength + int firstGoodIndex = (int) -Math.max(offset, -vlength); + VectorMask badMask2 = + iota.compare(LT, iota.broadcast(firstGoodIndex)); + if (indexLimit >= vlength) { + badMask = badMask2; // 1st badMask is all true + } else { + badMask = badMask.or(badMask2); + } + } + return badMask; + } + + private IndexOutOfBoundsException checkIndexFailed(long offset, int lane, + long length, int esize) { String msg = String.format("Masked range check failed: "+ "vector mask %s out of bounds at "+ - "index %d+%d in array of length %d", - this, offset, lane * esize, alength); + "index %d+%d for length %d", + this, offset, lane * esize, length); if (esize != 1) { - msg += String.format(" (each lane spans %d array elements)", esize); + msg += String.format(" (each lane spans %d elements)", esize); } throw new IndexOutOfBoundsException(msg); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractSpecies.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractSpecies.java index 4987546dc36..80f2de5d6cd 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractSpecies.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractSpecies.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,10 +24,11 @@ */ package jdk.incubator.vector; +import java.lang.foreign.MemorySegment; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.annotation.Stable; -import java.nio.ByteOrder; import java.lang.reflect.Array; +import java.nio.ByteOrder; import java.util.Arrays; import java.util.function.Function; import java.util.function.IntUnaryOperator; @@ -203,12 +204,24 @@ abstract class AbstractSpecies extends jdk.internal.vm.vector.VectorSupport.V return VectorIntrinsics.roundDown(length, laneCount); } + @Override + @ForceInline + public final long loopBound(long length) { + return VectorIntrinsics.roundDown(length, laneCount); + } + @Override @ForceInline public final VectorMask indexInRange(int offset, int limit) { return maskAll(true).indexInRange(offset, limit); } + @Override + @ForceInline + public final VectorMask indexInRange(long offset, long limit) { + return maskAll(true).indexInRange(offset, limit); + } + @Override @ForceInline public final VectorSpecies withLanes(Class newType) { @@ -349,9 +362,9 @@ abstract class AbstractSpecies extends jdk.internal.vm.vector.VectorSupport.V @ForceInline @Override - public final Vector fromByteArray(byte[] a, int offset, ByteOrder bo) { + public final Vector fromMemorySegment(MemorySegment ms, long offset, ByteOrder bo) { return dummyVector() - .fromByteArray0(a, offset) + .fromMemorySegment0(ms, offset) .maybeSwap(bo); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java index 7b2810479c9..ffc82872327 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,10 +24,10 @@ */ package jdk.incubator.vector; +import java.lang.foreign.MemorySegment; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.vector.VectorSupport; -import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.function.IntUnaryOperator; @@ -194,7 +194,7 @@ abstract class AbstractVector extends Vector { abstract AbstractShuffle shuffleFromOp(IntUnaryOperator fn); /*package-private*/ - abstract AbstractVector fromByteArray0(byte[] a, int offset); + abstract AbstractVector fromMemorySegment0(MemorySegment ms, long offset); /*package-private*/ abstract AbstractVector maybeSwap(ByteOrder bo); @@ -504,23 +504,23 @@ abstract class AbstractVector extends Vector { AbstractVector defaultReinterpret(AbstractSpecies rsp) { int blen = Math.max(this.bitSize(), rsp.vectorBitSize()) / Byte.SIZE; ByteOrder bo = ByteOrder.nativeOrder(); - ByteBuffer bb = ByteBuffer.allocate(blen); - this.intoByteBuffer(bb, 0, bo); + MemorySegment ms = MemorySegment.ofArray(new byte[blen]); + this.intoMemorySegment(ms, 0, bo); VectorMask m = rsp.maskAll(true); // enum-switches don't optimize properly JDK-8161245 switch (rsp.laneType.switchKey) { case LaneType.SK_BYTE: - return ByteVector.fromByteBuffer(rsp.check(byte.class), bb, 0, bo, m.check(byte.class)).check0(rsp); + return ByteVector.fromMemorySegment(rsp.check(byte.class), ms, 0, bo, m.check(byte.class)).check0(rsp); case LaneType.SK_SHORT: - return ShortVector.fromByteBuffer(rsp.check(short.class), bb, 0, bo, m.check(short.class)).check0(rsp); + return ShortVector.fromMemorySegment(rsp.check(short.class), ms, 0, bo, m.check(short.class)).check0(rsp); case LaneType.SK_INT: - return IntVector.fromByteBuffer(rsp.check(int.class), bb, 0, bo, m.check(int.class)).check0(rsp); + return IntVector.fromMemorySegment(rsp.check(int.class), ms, 0, bo, m.check(int.class)).check0(rsp); case LaneType.SK_LONG: - return LongVector.fromByteBuffer(rsp.check(long.class), bb, 0, bo, m.check(long.class)).check0(rsp); + return LongVector.fromMemorySegment(rsp.check(long.class), ms, 0, bo, m.check(long.class)).check0(rsp); case LaneType.SK_FLOAT: - return FloatVector.fromByteBuffer(rsp.check(float.class), bb, 0, bo, m.check(float.class)).check0(rsp); + return FloatVector.fromMemorySegment(rsp.check(float.class), ms, 0, bo, m.check(float.class)).check0(rsp); case LaneType.SK_DOUBLE: - return DoubleVector.fromByteBuffer(rsp.check(double.class), bb, 0, bo, m.check(double.class)).check0(rsp); + return DoubleVector.fromMemorySegment(rsp.check(double.class), ms, 0, bo, m.check(double.class)).check0(rsp); default: throw new AssertionError(rsp.toString()); } @@ -730,15 +730,6 @@ abstract class AbstractVector extends Vector { throw new AssertionError(); } - // Byte buffer wrappers. - static ByteBuffer wrapper(ByteBuffer bb, ByteOrder bo) { - return bb.duplicate().order(bo); - } - - static ByteBuffer wrapper(byte[] a, ByteOrder bo) { - return ByteBuffer.wrap(a).order(bo); - } - static { // Recode uses of VectorSupport.reinterpret if this assertion fails: assert(REGISTER_ENDIAN == ByteOrder.LITTLE_ENDIAN); diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java index 86627f9f33d..40ae99a21bf 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java @@ -24,7 +24,7 @@ */ package jdk.incubator.vector; -import java.nio.ByteBuffer; +import java.lang.foreign.MemorySegment; import java.util.Arrays; import java.util.Objects; import java.util.function.IntUnaryOperator; @@ -474,6 +474,22 @@ final class Byte128Vector extends ByteVector { (Byte128Vector) v); // specialize } + @Override + @ForceInline + public Byte128Vector compress(VectorMask m) { + return (Byte128Vector) + super.compressTemplate(Byte128Mask.class, + (Byte128Mask) m); // specialize + } + + @Override + @ForceInline + public Byte128Vector expand(VectorMask m) { + return (Byte128Vector) + super.expandTemplate(Byte128Mask.class, + (Byte128Mask) m); // specialize + } + @Override @ForceInline public Byte128Vector selectFrom(Vector v) { @@ -677,6 +693,15 @@ final class Byte128Vector extends ByteVector { return xor(maskAll(true)); } + @Override + @ForceInline + public Byte128Mask compress() { + return (Byte128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, + Byte128Vector.class, Byte128Mask.class, ETYPE, VLENGTH, null, this, + (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); + } + + // Binary operations @Override @@ -876,29 +901,15 @@ final class Byte128Vector extends ByteVector { @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset) { - return super.fromByteArray0Template(a, offset); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset) { + return super.fromMemorySegment0Template(ms, offset); // specialize } @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset, VectorMask m) { - return super.fromByteArray0Template(Byte128Mask.class, a, offset, (Byte128Mask) m); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset) { - return super.fromByteBuffer0Template(bb, offset); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - return super.fromByteBuffer0Template(Byte128Mask.class, bb, offset, (Byte128Mask) m); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + return super.fromMemorySegment0Template(Byte128Mask.class, ms, offset, (Byte128Mask) m); // specialize } @ForceInline @@ -926,22 +937,8 @@ final class Byte128Vector extends ByteVector { @ForceInline @Override final - void intoByteArray0(byte[] a, int offset) { - super.intoByteArray0Template(a, offset); // specialize - } - - @ForceInline - @Override - final - void intoByteArray0(byte[] a, int offset, VectorMask m) { - super.intoByteArray0Template(Byte128Mask.class, a, offset, (Byte128Mask) m); // specialize - } - - @ForceInline - @Override - final - void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - super.intoByteBuffer0Template(Byte128Mask.class, bb, offset, (Byte128Mask) m); + void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + super.intoMemorySegment0Template(Byte128Mask.class, ms, offset, (Byte128Mask) m); } @@ -950,3 +947,4 @@ final class Byte128Vector extends ByteVector { // ================================================ } + diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java index f5f9977db08..e3f35b05fa0 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java @@ -24,7 +24,7 @@ */ package jdk.incubator.vector; -import java.nio.ByteBuffer; +import java.lang.foreign.MemorySegment; import java.util.Arrays; import java.util.Objects; import java.util.function.IntUnaryOperator; @@ -474,6 +474,22 @@ final class Byte256Vector extends ByteVector { (Byte256Vector) v); // specialize } + @Override + @ForceInline + public Byte256Vector compress(VectorMask m) { + return (Byte256Vector) + super.compressTemplate(Byte256Mask.class, + (Byte256Mask) m); // specialize + } + + @Override + @ForceInline + public Byte256Vector expand(VectorMask m) { + return (Byte256Vector) + super.expandTemplate(Byte256Mask.class, + (Byte256Mask) m); // specialize + } + @Override @ForceInline public Byte256Vector selectFrom(Vector v) { @@ -709,6 +725,15 @@ final class Byte256Vector extends ByteVector { return xor(maskAll(true)); } + @Override + @ForceInline + public Byte256Mask compress() { + return (Byte256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, + Byte256Vector.class, Byte256Mask.class, ETYPE, VLENGTH, null, this, + (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); + } + + // Binary operations @Override @@ -908,29 +933,15 @@ final class Byte256Vector extends ByteVector { @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset) { - return super.fromByteArray0Template(a, offset); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset) { + return super.fromMemorySegment0Template(ms, offset); // specialize } @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset, VectorMask m) { - return super.fromByteArray0Template(Byte256Mask.class, a, offset, (Byte256Mask) m); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset) { - return super.fromByteBuffer0Template(bb, offset); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - return super.fromByteBuffer0Template(Byte256Mask.class, bb, offset, (Byte256Mask) m); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + return super.fromMemorySegment0Template(Byte256Mask.class, ms, offset, (Byte256Mask) m); // specialize } @ForceInline @@ -958,22 +969,8 @@ final class Byte256Vector extends ByteVector { @ForceInline @Override final - void intoByteArray0(byte[] a, int offset) { - super.intoByteArray0Template(a, offset); // specialize - } - - @ForceInline - @Override - final - void intoByteArray0(byte[] a, int offset, VectorMask m) { - super.intoByteArray0Template(Byte256Mask.class, a, offset, (Byte256Mask) m); // specialize - } - - @ForceInline - @Override - final - void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - super.intoByteBuffer0Template(Byte256Mask.class, bb, offset, (Byte256Mask) m); + void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + super.intoMemorySegment0Template(Byte256Mask.class, ms, offset, (Byte256Mask) m); } @@ -982,3 +979,4 @@ final class Byte256Vector extends ByteVector { // ================================================ } + diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java index e72dbed51dc..10a432cf771 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java @@ -24,7 +24,7 @@ */ package jdk.incubator.vector; -import java.nio.ByteBuffer; +import java.lang.foreign.MemorySegment; import java.util.Arrays; import java.util.Objects; import java.util.function.IntUnaryOperator; @@ -474,6 +474,22 @@ final class Byte512Vector extends ByteVector { (Byte512Vector) v); // specialize } + @Override + @ForceInline + public Byte512Vector compress(VectorMask m) { + return (Byte512Vector) + super.compressTemplate(Byte512Mask.class, + (Byte512Mask) m); // specialize + } + + @Override + @ForceInline + public Byte512Vector expand(VectorMask m) { + return (Byte512Vector) + super.expandTemplate(Byte512Mask.class, + (Byte512Mask) m); // specialize + } + @Override @ForceInline public Byte512Vector selectFrom(Vector v) { @@ -773,6 +789,15 @@ final class Byte512Vector extends ByteVector { return xor(maskAll(true)); } + @Override + @ForceInline + public Byte512Mask compress() { + return (Byte512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, + Byte512Vector.class, Byte512Mask.class, ETYPE, VLENGTH, null, this, + (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); + } + + // Binary operations @Override @@ -972,29 +997,15 @@ final class Byte512Vector extends ByteVector { @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset) { - return super.fromByteArray0Template(a, offset); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset) { + return super.fromMemorySegment0Template(ms, offset); // specialize } @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset, VectorMask m) { - return super.fromByteArray0Template(Byte512Mask.class, a, offset, (Byte512Mask) m); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset) { - return super.fromByteBuffer0Template(bb, offset); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - return super.fromByteBuffer0Template(Byte512Mask.class, bb, offset, (Byte512Mask) m); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + return super.fromMemorySegment0Template(Byte512Mask.class, ms, offset, (Byte512Mask) m); // specialize } @ForceInline @@ -1022,22 +1033,8 @@ final class Byte512Vector extends ByteVector { @ForceInline @Override final - void intoByteArray0(byte[] a, int offset) { - super.intoByteArray0Template(a, offset); // specialize - } - - @ForceInline - @Override - final - void intoByteArray0(byte[] a, int offset, VectorMask m) { - super.intoByteArray0Template(Byte512Mask.class, a, offset, (Byte512Mask) m); // specialize - } - - @ForceInline - @Override - final - void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - super.intoByteBuffer0Template(Byte512Mask.class, bb, offset, (Byte512Mask) m); + void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + super.intoMemorySegment0Template(Byte512Mask.class, ms, offset, (Byte512Mask) m); } @@ -1046,3 +1043,4 @@ final class Byte512Vector extends ByteVector { // ================================================ } + diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java index c5e060b8de9..80de3a3b446 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java @@ -24,7 +24,7 @@ */ package jdk.incubator.vector; -import java.nio.ByteBuffer; +import java.lang.foreign.MemorySegment; import java.util.Arrays; import java.util.Objects; import java.util.function.IntUnaryOperator; @@ -474,6 +474,22 @@ final class Byte64Vector extends ByteVector { (Byte64Vector) v); // specialize } + @Override + @ForceInline + public Byte64Vector compress(VectorMask m) { + return (Byte64Vector) + super.compressTemplate(Byte64Mask.class, + (Byte64Mask) m); // specialize + } + + @Override + @ForceInline + public Byte64Vector expand(VectorMask m) { + return (Byte64Vector) + super.expandTemplate(Byte64Mask.class, + (Byte64Mask) m); // specialize + } + @Override @ForceInline public Byte64Vector selectFrom(Vector v) { @@ -661,6 +677,15 @@ final class Byte64Vector extends ByteVector { return xor(maskAll(true)); } + @Override + @ForceInline + public Byte64Mask compress() { + return (Byte64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, + Byte64Vector.class, Byte64Mask.class, ETYPE, VLENGTH, null, this, + (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); + } + + // Binary operations @Override @@ -860,29 +885,15 @@ final class Byte64Vector extends ByteVector { @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset) { - return super.fromByteArray0Template(a, offset); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset) { + return super.fromMemorySegment0Template(ms, offset); // specialize } @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset, VectorMask m) { - return super.fromByteArray0Template(Byte64Mask.class, a, offset, (Byte64Mask) m); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset) { - return super.fromByteBuffer0Template(bb, offset); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - return super.fromByteBuffer0Template(Byte64Mask.class, bb, offset, (Byte64Mask) m); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + return super.fromMemorySegment0Template(Byte64Mask.class, ms, offset, (Byte64Mask) m); // specialize } @ForceInline @@ -910,22 +921,8 @@ final class Byte64Vector extends ByteVector { @ForceInline @Override final - void intoByteArray0(byte[] a, int offset) { - super.intoByteArray0Template(a, offset); // specialize - } - - @ForceInline - @Override - final - void intoByteArray0(byte[] a, int offset, VectorMask m) { - super.intoByteArray0Template(Byte64Mask.class, a, offset, (Byte64Mask) m); // specialize - } - - @ForceInline - @Override - final - void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - super.intoByteBuffer0Template(Byte64Mask.class, bb, offset, (Byte64Mask) m); + void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + super.intoMemorySegment0Template(Byte64Mask.class, ms, offset, (Byte64Mask) m); } @@ -934,3 +931,4 @@ final class Byte64Vector extends ByteVector { // ================================================ } + diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java index 5239cd33ea0..67e04561a79 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java @@ -24,7 +24,7 @@ */ package jdk.incubator.vector; -import java.nio.ByteBuffer; +import java.lang.foreign.MemorySegment; import java.util.Arrays; import java.util.Objects; import java.util.function.IntUnaryOperator; @@ -474,6 +474,22 @@ final class ByteMaxVector extends ByteVector { (ByteMaxVector) v); // specialize } + @Override + @ForceInline + public ByteMaxVector compress(VectorMask m) { + return (ByteMaxVector) + super.compressTemplate(ByteMaxMask.class, + (ByteMaxMask) m); // specialize + } + + @Override + @ForceInline + public ByteMaxVector expand(VectorMask m) { + return (ByteMaxVector) + super.expandTemplate(ByteMaxMask.class, + (ByteMaxMask) m); // specialize + } + @Override @ForceInline public ByteMaxVector selectFrom(Vector v) { @@ -647,6 +663,15 @@ final class ByteMaxVector extends ByteVector { return xor(maskAll(true)); } + @Override + @ForceInline + public ByteMaxMask compress() { + return (ByteMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, + ByteMaxVector.class, ByteMaxMask.class, ETYPE, VLENGTH, null, this, + (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); + } + + // Binary operations @Override @@ -846,29 +871,15 @@ final class ByteMaxVector extends ByteVector { @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset) { - return super.fromByteArray0Template(a, offset); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset) { + return super.fromMemorySegment0Template(ms, offset); // specialize } @ForceInline @Override final - ByteVector fromByteArray0(byte[] a, int offset, VectorMask m) { - return super.fromByteArray0Template(ByteMaxMask.class, a, offset, (ByteMaxMask) m); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset) { - return super.fromByteBuffer0Template(bb, offset); // specialize - } - - @ForceInline - @Override - final - ByteVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - return super.fromByteBuffer0Template(ByteMaxMask.class, bb, offset, (ByteMaxMask) m); // specialize + ByteVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + return super.fromMemorySegment0Template(ByteMaxMask.class, ms, offset, (ByteMaxMask) m); // specialize } @ForceInline @@ -896,22 +907,8 @@ final class ByteMaxVector extends ByteVector { @ForceInline @Override final - void intoByteArray0(byte[] a, int offset) { - super.intoByteArray0Template(a, offset); // specialize - } - - @ForceInline - @Override - final - void intoByteArray0(byte[] a, int offset, VectorMask m) { - super.intoByteArray0Template(ByteMaxMask.class, a, offset, (ByteMaxMask) m); // specialize - } - - @ForceInline - @Override - final - void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) { - super.intoByteBuffer0Template(ByteMaxMask.class, bb, offset, (ByteMaxMask) m); + void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) { + super.intoMemorySegment0Template(ByteMaxMask.class, ms, offset, (ByteMaxMask) m); } @@ -920,3 +917,4 @@ final class ByteMaxVector extends ByteVector { // ================================================ } + diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java index e878f938c39..e137fc05741 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java @@ -24,14 +24,14 @@ */ package jdk.incubator.vector; -import java.nio.ByteBuffer; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; import java.nio.ByteOrder; -import java.nio.ReadOnlyBufferException; import java.util.Arrays; import java.util.Objects; import java.util.function.Function; -import java.util.function.UnaryOperator; +import jdk.internal.foreign.AbstractMemorySegmentImpl; import jdk.internal.misc.ScopedMemoryAccess; import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.ForceInline; @@ -57,6 +57,8 @@ public abstract class ByteVector extends AbstractVector { static final int FORBID_OPCODE_KIND = VO_ONLYFP; + static final ValueLayout.OfByte ELEMENT_LAYOUT = ValueLayout.JAVA_BYTE.withBitAlignment(8); + @ForceInline static int opCode(Operator op) { return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND); @@ -351,6 +353,45 @@ public abstract class ByteVector extends AbstractVector { return vectorFactory(res); } + /*package-private*/ + interface FLdLongOp { + byte apply(MemorySegment memory, long offset, int i); + } + + /*package-private*/ + @ForceInline + final + ByteVector ldLongOp(MemorySegment memory, long offset, + FLdLongOp f) { + //dummy; no vec = vec(); + byte[] res = new byte[length()]; + for (int i = 0; i < res.length; i++) { + res[i] = f.apply(memory, offset, i); + } + return vectorFactory(res); + } + + /*package-private*/ + @ForceInline + final + ByteVector ldLongOp(MemorySegment memory, long offset, + VectorMask m, + FLdLongOp f) { + //byte[] vec = vec(); + byte[] res = new byte[length()]; + boolean[] mbits = ((AbstractMask)m).getBits(); + for (int i = 0; i < res.length; i++) { + if (mbits[i]) { + res[i] = f.apply(memory, offset, i); + } + } + return vectorFactory(res); + } + + static byte memorySegmentGet(MemorySegment ms, long o, int i) { + return ms.get(ELEMENT_LAYOUT, o + i * 1L); + } + interface FStOp { void apply(M memory, int offset, int i, byte a); } @@ -381,6 +422,40 @@ public abstract class ByteVector extends AbstractVector { } } + interface FStLongOp { + void apply(MemorySegment memory, long offset, int i, byte a); + } + + /*package-private*/ + @ForceInline + final + void stLongOp(MemorySegment memory, long offset, + FStLongOp f) { + byte[] vec = vec(); + for (int i = 0; i < vec.length; i++) { + f.apply(memory, offset, i, vec[i]); + } + } + + /*package-private*/ + @ForceInline + final + void stLongOp(MemorySegment memory, long offset, + VectorMask m, + FStLongOp f) { + byte[] vec = vec(); + boolean[] mbits = ((AbstractMask)m).getBits(); + for (int i = 0; i < vec.length; i++) { + if (mbits[i]) { + f.apply(memory, offset, i, vec[i]); + } + } + } + + static void memorySegmentSet(MemorySegment ms, long o, int i, byte e) { + ms.set(ELEMENT_LAYOUT, o + i * 1L, e); + } + // Binary test /*package-private*/ @@ -431,6 +506,36 @@ public abstract class ByteVector extends AbstractVector { return ((byte)bits); } + static ByteVector expandHelper(Vector v, VectorMask m) { + VectorSpecies vsp = m.vectorSpecies(); + ByteVector r = (ByteVector) vsp.zero(); + ByteVector vi = (ByteVector) v; + if (m.allTrue()) { + return vi; + } + for (int i = 0, j = 0; i < vsp.length(); i++) { + if (m.laneIsSet(i)) { + r = r.withLane(i, vi.lane(j++)); + } + } + return r; + } + + static ByteVector compressHelper(Vector v, VectorMask m) { + VectorSpecies vsp = m.vectorSpecies(); + ByteVector r = (ByteVector) vsp.zero(); + ByteVector vi = (ByteVector) v; + if (m.allTrue()) { + return vi; + } + for (int i = 0, j = 0; i < vsp.length(); i++) { + if (m.laneIsSet(i)) { + r = r.withLane(j++, vi.lane(i)); + } + } + return r; + } + // Static factories (other than memory operations) // Note: A surprising behavior in javadoc @@ -620,6 +725,16 @@ public abstract class ByteVector extends AbstractVector { v0.uOp(m, (i, a) -> (byte) -a); case VECTOR_OP_ABS: return (v0, m) -> v0.uOp(m, (i, a) -> (byte) Math.abs(a)); + case VECTOR_OP_BIT_COUNT: return (v0, m) -> + v0.uOp(m, (i, a) -> (byte) bitCount(a)); + case VECTOR_OP_TZ_COUNT: return (v0, m) -> + v0.uOp(m, (i, a) -> (byte) numberOfTrailingZeros(a)); + case VECTOR_OP_LZ_COUNT: return (v0, m) -> + v0.uOp(m, (i, a) -> (byte) numberOfLeadingZeros(a)); + case VECTOR_OP_REVERSE: return (v0, m) -> + v0.uOp(m, (i, a) -> reverse(a)); + case VECTOR_OP_REVERSE_BYTES: return (v0, m) -> + v0.uOp(m, (i, a) -> a); default: return null; } } @@ -1746,6 +1861,25 @@ public abstract class ByteVector extends AbstractVector { return lanewise(ABS); } + static int bitCount(byte a) { + return Integer.bitCount((int)a & 0xFF); + } + static int numberOfTrailingZeros(byte a) { + return a != 0 ? Integer.numberOfTrailingZeros(a) : 8; + } + static int numberOfLeadingZeros(byte a) { + return a >= 0 ? Integer.numberOfLeadingZeros(a) - 24 : 0; + } + + static byte reverse(byte a) { + if (a == 0 || a == -1) return a; + + byte b = rotateLeft(a, 4); + b = (byte) (((b & 0x55) << 1) | ((b & 0xAA) >>> 1)); + b = (byte) (((b & 0x33) << 2) | ((b & 0xCC) >>> 2)); + return b; + } + // not (~) /** * Computes the bitwise logical complement ({@code ~}) @@ -2372,6 +2506,45 @@ public abstract class ByteVector extends AbstractVector { ByteVector::toShuffle0); } + /** + * {@inheritDoc} + * @since 19 + */ + @Override + public abstract + ByteVector compress(VectorMask m); + + /*package-private*/ + @ForceInline + final + > + ByteVector compressTemplate(Class masktype, M m) { + m.check(masktype, this); + return (ByteVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype, + byte.class, length(), this, m, + (v1, m1) -> compressHelper(v1, m1)); + } + + /** + * {@inheritDoc} + * @since 19 + */ + @Override + public abstract + ByteVector expand(VectorMask m); + + /*package-private*/ + @ForceInline + final + > + ByteVector expandTemplate(Class masktype, M m) { + m.check(masktype, this); + return (ByteVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype, + byte.class, length(), this, m, + (v1, m1) -> expandHelper(v1, m1)); + } + + /** * {@inheritDoc} */ @@ -2784,90 +2957,6 @@ public abstract class ByteVector extends AbstractVector { return res; } - /** - * Loads a vector from a byte array starting at an offset. - * Bytes are composed into primitive lane elements according - * to the specified byte order. - * The vector is arranged into lanes according to - * memory ordering. - *

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - */ - @ForceInline - public static - ByteVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), a.length); - ByteSpecies vsp = (ByteSpecies) species; - return vsp.dummyVector().fromByteArray0(a, offset).maybeSwap(bo); - } - - /** - * Loads a vector from a byte array starting at an offset - * and using a mask. - * Lanes where the mask is unset are filled with the default - * value of {@code byte} (zero). - * Bytes are composed into primitive lane elements according - * to the specified byte order. - * The vector is arranged into lanes according to - * memory ordering. - *

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @param m the mask controlling lane selection - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - * where the mask is set - */ - @ForceInline - public static - ByteVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo, - VectorMask m) { - ByteSpecies vsp = (ByteSpecies) species; - if (offset >= 0 && offset <= (a.length - species.vectorByteSize())) { - return vsp.dummyVector().fromByteArray0(a, offset, m).maybeSwap(bo); - } - - // FIXME: optimize - checkMaskFromIndexSize(offset, vsp, m, 1, a.length); - ByteBuffer wb = wrapper(a, bo); - return vsp.ldOp(wb, offset, (AbstractMask)m, - (wb_, o, i) -> wb_.get(o + i * 1)); - } - /** * Loads a vector from an array of type {@code byte[]} * starting at an offset. @@ -3174,44 +3263,49 @@ public abstract class ByteVector extends AbstractVector { } /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer. + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment. * Bytes are composed into primitive lane elements according * to the specified byte order. * The vector is arranged into lanes according to * memory ordering. *

* This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: + * {@link #fromMemorySegment(VectorSpecies,MemorySegment,long,ByteOrder,VectorMask) + * fromMemorySegment()} as follows: *

{@code
      * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
+     * return fromMemorySegment(species, ms, offset, bo, m);
      * }
* * @param species species of desired vector - * @param bb the byte buffer - * @param offset the offset into the byte buffer + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order - * @return a vector loaded from a byte buffer + * @return a vector loaded from the memory segment * @throws IndexOutOfBoundsException * if {@code offset+N*1 < 0} - * or {@code offset+N*1 >= bb.limit()} + * or {@code offset+N*1 >= ms.byteSize()} * for any lane {@code N} in the vector + * @throws IllegalArgumentException if the memory segment is a heap segment that is + * not backed by a {@code byte[]} array. + * @throws IllegalStateException if the memory segment's session is not alive, + * or if access occurs from a thread other than the thread owning the session. + * @since 19 */ @ForceInline public static - ByteVector fromByteBuffer(VectorSpecies species, - ByteBuffer bb, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), bb.limit()); + ByteVector fromMemorySegment(VectorSpecies species, + MemorySegment ms, long offset, + ByteOrder bo) { + offset = checkFromIndexSize(offset, species.vectorByteSize(), ms.byteSize()); ByteSpecies vsp = (ByteSpecies) species; - return vsp.dummyVector().fromByteBuffer0(bb, offset).maybeSwap(bo); + return vsp.dummyVector().fromMemorySegment0(ms, offset).maybeSwap(bo); } /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment * and using a mask. * Lanes where the mask is unset are filled with the default * value of {@code byte} (zero). @@ -3222,12 +3316,11 @@ public abstract class ByteVector extends AbstractVector { *

* The following pseudocode illustrates the behavior: *

{@code
-     * ByteBuffer eb = bb.duplicate()
-     *     .position(offset);
+     * var slice = ms.asSlice(offset);
      * byte[] ar = new byte[species.length()];
      * for (int n = 0; n < ar.length; n++) {
      *     if (m.laneIsSet(n)) {
-     *         ar[n] = eb.get(n);
+     *         ar[n] = slice.getAtIndex(ValuaLayout.JAVA_BYTE.withBitAlignment(8), n);
      *     }
      * }
      * ByteVector r = ByteVector.fromArray(species, ar, 0);
@@ -3236,33 +3329,36 @@ public abstract class ByteVector extends AbstractVector {
      * The byte order argument is ignored.
      *
      * @param species species of desired vector
-     * @param bb the byte buffer
-     * @param offset the offset into the byte buffer
+     * @param ms the memory segment
+     * @param offset the offset into the memory segment
      * @param bo the intended byte order
      * @param m the mask controlling lane selection
-     * @return a vector loaded from a byte buffer
+     * @return a vector loaded from the memory segment
      * @throws IndexOutOfBoundsException
      *         if {@code offset+N*1 < 0}
-     *         or {@code offset+N*1 >= bb.limit()}
+     *         or {@code offset+N*1 >= ms.byteSize()}
      *         for any lane {@code N} in the vector
      *         where the mask is set
+     * @throws IllegalArgumentException if the memory segment is a heap segment that is
+     *         not backed by a {@code byte[]} array.
+     * @throws IllegalStateException if the memory segment's session is not alive,
+     *         or if access occurs from a thread other than the thread owning the session.
+     * @since 19
      */
     @ForceInline
     public static
-    ByteVector fromByteBuffer(VectorSpecies species,
-                                        ByteBuffer bb, int offset,
-                                        ByteOrder bo,
-                                        VectorMask m) {
+    ByteVector fromMemorySegment(VectorSpecies species,
+                                           MemorySegment ms, long offset,
+                                           ByteOrder bo,
+                                           VectorMask m) {
         ByteSpecies vsp = (ByteSpecies) species;
-        if (offset >= 0 && offset <= (bb.limit() - species.vectorByteSize())) {
-            return vsp.dummyVector().fromByteBuffer0(bb, offset, m).maybeSwap(bo);
+        if (offset >= 0 && offset <= (ms.byteSize() - species.vectorByteSize())) {
+            return vsp.dummyVector().fromMemorySegment0(ms, offset, m).maybeSwap(bo);
         }
 
         // FIXME: optimize
-        checkMaskFromIndexSize(offset, vsp, m, 1, bb.limit());
-        ByteBuffer wb = wrapper(bb, bo);
-        return vsp.ldOp(wb, offset, (AbstractMask)m,
-                   (wb_, o, i)  -> wb_.get(o + i * 1));
+        checkMaskFromIndexSize(offset, vsp, m, 1, ms.byteSize());
+        return vsp.ldLongOp(ms, offset, m, ByteVector::memorySegmentGet);
     }
 
     // Memory store operations
@@ -3292,7 +3388,7 @@ public abstract class ByteVector extends AbstractVector {
             this,
             a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3443,7 +3539,7 @@ public abstract class ByteVector extends AbstractVector {
             normalized,
             a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_ + i] = (e & 1) != 0));
     }
 
@@ -3581,67 +3677,40 @@ public abstract class ByteVector extends AbstractVector {
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo) {
-        offset = checkFromIndexSize(offset, byteSize(), a.length);
-        maybeSwap(bo).intoByteArray0(a, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo,
-                       VectorMask m) {
-        if (m.allTrue()) {
-            intoByteArray(a, offset, bo);
-        } else {
-            ByteSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 1, a.length);
-            maybeSwap(bo).intoByteArray0(a, offset, m);
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo) {
+        if (ms.isReadOnly()) {
+            throw new UnsupportedOperationException("Attempt to write a read-only segment");
         }
+
+        offset = checkFromIndexSize(offset, byteSize(), ms.byteSize());
+        maybeSwap(bo).intoMemorySegment0(ms, offset);
     }
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo) {
-        if (ScopedMemoryAccess.isReadOnly(bb)) {
-            throw new ReadOnlyBufferException();
-        }
-        offset = checkFromIndexSize(offset, byteSize(), bb.limit());
-        maybeSwap(bo).intoByteBuffer0(bb, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo,
-                        VectorMask m) {
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo,
+                           VectorMask m) {
         if (m.allTrue()) {
-            intoByteBuffer(bb, offset, bo);
+            intoMemorySegment(ms, offset, bo);
         } else {
-            if (bb.isReadOnly()) {
-                throw new ReadOnlyBufferException();
+            if (ms.isReadOnly()) {
+                throw new UnsupportedOperationException("Attempt to write a read-only segment");
             }
             ByteSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 1, bb.limit());
-            maybeSwap(bo).intoByteBuffer0(bb, offset, m);
+            checkMaskFromIndexSize(offset, vsp, m, 1, ms.byteSize());
+            maybeSwap(bo).intoMemorySegment0(ms, offset, m);
         }
     }
 
@@ -3675,7 +3744,7 @@ public abstract class ByteVector extends AbstractVector {
             vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset),
             a, offset, vsp,
-            (arr, off, s) -> s.ldOp(arr, off,
+            (arr, off, s) -> s.ldOp(arr, (int) off,
                                     (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3692,7 +3761,7 @@ public abstract class ByteVector extends AbstractVector {
             vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset), m,
             a, offset, vsp,
-            (arr, off, s, vm) -> s.ldOp(arr, off, vm,
+            (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                         (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3709,7 +3778,7 @@ public abstract class ByteVector extends AbstractVector {
             vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
             a, booleanArrayAddress(a, offset),
             a, offset, vsp,
-            (arr, off, s) -> s.ldOp(arr, off,
+            (arr, off, s) -> s.ldOp(arr, (int) off,
                                     (arr_, off_, i) -> (byte) (arr_[off_ + i] ? 1 : 0)));
     }
 
@@ -3726,78 +3795,37 @@ public abstract class ByteVector extends AbstractVector {
             vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
             a, booleanArrayAddress(a, offset), m,
             a, offset, vsp,
-            (arr, off, s, vm) -> s.ldOp(arr, off, vm,
+            (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                         (arr_, off_, i) -> (byte) (arr_[off_ + i] ? 1 : 0)));
     }
 
-    @Override
     abstract
-    ByteVector fromByteArray0(byte[] a, int offset);
+    ByteVector fromMemorySegment0(MemorySegment bb, long offset);
     @ForceInline
     final
-    ByteVector fromByteArray0Template(byte[] a, int offset) {
+    ByteVector fromMemorySegment0Template(MemorySegment ms, long offset) {
         ByteSpecies vsp = vspecies();
-        return VectorSupport.load(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            a, offset, vsp,
-            (arr, off, s) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off,
-                        (wb_, o, i) -> wb_.get(o + i * 1));
-            });
-    }
-
-    abstract
-    ByteVector fromByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    ByteVector fromByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        ByteSpecies vsp = vspecies();
-        m.check(vsp);
-        return VectorSupport.loadMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset), m,
-            a, offset, vsp,
-            (arr, off, s, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off, vm,
-                        (wb_, o, i) -> wb_.get(o + i * 1));
-            });
-    }
-
-    abstract
-    ByteVector fromByteBuffer0(ByteBuffer bb, int offset);
-    @ForceInline
-    final
-    ByteVector fromByteBuffer0Template(ByteBuffer bb, int offset) {
-        ByteSpecies vsp = vspecies();
-        return ScopedMemoryAccess.loadFromByteBuffer(
+        return ScopedMemoryAccess.loadFromMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                bb, offset, vsp,
-                (buf, off, s) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off,
-                            (wb_, o, i) -> wb_.get(o + i * 1));
+                (AbstractMemorySegmentImpl) ms, offset, vsp,
+                (msp, off, s) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, ByteVector::memorySegmentGet);
                 });
     }
 
     abstract
-    ByteVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    ByteVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m);
     @ForceInline
     final
     >
-    ByteVector fromByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    ByteVector fromMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         ByteSpecies vsp = vspecies();
         m.check(vsp);
-        return ScopedMemoryAccess.loadFromByteBufferMasked(
+        return ScopedMemoryAccess.loadFromMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                bb, offset, m, vsp,
-                (buf, off, s, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off, vm,
-                            (wb_, o, i) -> wb_.get(o + i * 1));
+                (AbstractMemorySegmentImpl) ms, offset, m, vsp,
+                (msp, off, s, vm) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, vm, ByteVector::memorySegmentGet);
                 });
     }
 
@@ -3816,7 +3844,7 @@ public abstract class ByteVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_+i] = e));
     }
 
@@ -3833,7 +3861,7 @@ public abstract class ByteVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, m, a, offset,
             (arr, off, v, vm)
-            -> v.stOp(arr, off, vm,
+            -> v.stOp(arr, (int) off, vm,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3852,75 +3880,37 @@ public abstract class ByteVector extends AbstractVector {
             a, booleanArrayAddress(a, offset),
             normalized, m, a, offset,
             (arr, off, v, vm)
-            -> v.stOp(arr, off, vm,
+            -> v.stOp(arr, (int) off, vm,
                       (arr_, off_, i, e) -> arr_[off_ + i] = (e & 1) != 0));
     }
 
-    abstract
-    void intoByteArray0(byte[] a, int offset);
     @ForceInline
     final
-    void intoByteArray0Template(byte[] a, int offset) {
+    void intoMemorySegment0(MemorySegment ms, long offset) {
         ByteSpecies vsp = vspecies();
-        VectorSupport.store(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, a, offset,
-            (arr, off, v) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off,
-                        (tb_, o, i, e) -> tb_.put(o + i * 1, e));
-            });
-    }
-
-    abstract
-    void intoByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    void intoByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        ByteSpecies vsp = vspecies();
-        m.check(vsp);
-        VectorSupport.storeMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, m, a, offset,
-            (arr, off, v, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off, vm,
-                        (tb_, o, i, e) -> tb_.put(o + i * 1, e));
-            });
-    }
-
-    @ForceInline
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset) {
-        ByteSpecies vsp = vspecies();
-        ScopedMemoryAccess.storeIntoByteBuffer(
+        ScopedMemoryAccess.storeIntoMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                this, bb, offset,
-                (buf, off, v) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off,
-                            (wb_, o, i, e) -> wb_.put(o + i * 1, e));
+                this,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v) -> {
+                    v.stLongOp((MemorySegment) msp, off, ByteVector::memorySegmentSet);
                 });
     }
 
     abstract
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    void intoMemorySegment0(MemorySegment bb, long offset, VectorMask m);
     @ForceInline
     final
     >
-    void intoByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    void intoMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         ByteSpecies vsp = vspecies();
         m.check(vsp);
-        ScopedMemoryAccess.storeIntoByteBufferMasked(
+        ScopedMemoryAccess.storeIntoMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                this, m, bb, offset,
-                (buf, off, v, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off, vm,
-                            (wb_, o, i, e) -> wb_.put(o + i * 1, e));
+                this, m,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v, vm) -> {
+                    v.stLongOp((MemorySegment) msp, off, vm, ByteVector::memorySegmentSet);
                 });
     }
 
@@ -3937,6 +3927,16 @@ public abstract class ByteVector extends AbstractVector {
             .checkIndexByLane(offset, limit, vsp.iota(), scale);
     }
 
+    private static
+    void checkMaskFromIndexSize(long offset,
+                                ByteSpecies vsp,
+                                VectorMask m,
+                                int scale,
+                                long limit) {
+        ((AbstractMask)m)
+            .checkIndexByLane(offset, limit, vsp.iota(), scale);
+    }
+
     @ForceInline
     private void conditionalStoreNYI(int offset,
                                      ByteSpecies vsp,
@@ -4256,6 +4256,21 @@ public abstract class ByteVector extends AbstractVector {
             return dummyVector().ldOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        ByteVector ldLongOp(MemorySegment memory, long offset,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        ByteVector ldLongOp(MemorySegment memory, long offset,
+                                      VectorMask m,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, m, f);
+        }
+
         /*package-private*/
         @ForceInline
          void stOp(M memory, int offset, FStOp f) {
@@ -4270,6 +4285,20 @@ public abstract class ByteVector extends AbstractVector {
             dummyVector().stOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset, FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset,
+                      AbstractMask m,
+                      FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, m, f);
+        }
+
         // N.B. Make sure these constant vectors and
         // masks load up correctly into registers.
         //
@@ -4383,3 +4412,4 @@ public abstract class ByteVector extends AbstractVector {
     public static final VectorSpecies SPECIES_PREFERRED
         = (ByteSpecies) VectorSpecies.ofPreferred(byte.class);
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java
index 24c32c848c3..7a482991bbb 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class Double128Vector extends DoubleVector {
                                     (Double128Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Double128Vector compress(VectorMask m) {
+        return (Double128Vector)
+            super.compressTemplate(Double128Mask.class,
+                                   (Double128Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Double128Vector expand(VectorMask m) {
+        return (Double128Vector)
+            super.expandTemplate(Double128Mask.class,
+                                   (Double128Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Double128Vector selectFrom(Vector v) {
@@ -638,6 +654,15 @@ final class Double128Vector extends DoubleVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Double128Mask compress() {
+            return (Double128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Double128Vector.class, Double128Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -830,29 +855,15 @@ final class Double128Vector extends DoubleVector {
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Double128Mask.class, a, offset, (Double128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Double128Mask.class, bb, offset, (Double128Mask) m);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Double128Mask.class, ms, offset, (Double128Mask) m);  // specialize
     }
 
     @ForceInline
@@ -880,22 +891,8 @@ final class Double128Vector extends DoubleVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Double128Mask.class, a, offset, (Double128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Double128Mask.class, bb, offset, (Double128Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Double128Mask.class, ms, offset, (Double128Mask) m);
     }
 
 
@@ -904,3 +901,4 @@ final class Double128Vector extends DoubleVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java
index e265dc86288..0348abcc4b1 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class Double256Vector extends DoubleVector {
                                     (Double256Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Double256Vector compress(VectorMask m) {
+        return (Double256Vector)
+            super.compressTemplate(Double256Mask.class,
+                                   (Double256Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Double256Vector expand(VectorMask m) {
+        return (Double256Vector)
+            super.expandTemplate(Double256Mask.class,
+                                   (Double256Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Double256Vector selectFrom(Vector v) {
@@ -642,6 +658,15 @@ final class Double256Vector extends DoubleVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Double256Mask compress() {
+            return (Double256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Double256Vector.class, Double256Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -834,29 +859,15 @@ final class Double256Vector extends DoubleVector {
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Double256Mask.class, a, offset, (Double256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Double256Mask.class, bb, offset, (Double256Mask) m);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Double256Mask.class, ms, offset, (Double256Mask) m);  // specialize
     }
 
     @ForceInline
@@ -884,22 +895,8 @@ final class Double256Vector extends DoubleVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Double256Mask.class, a, offset, (Double256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Double256Mask.class, bb, offset, (Double256Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Double256Mask.class, ms, offset, (Double256Mask) m);
     }
 
 
@@ -908,3 +905,4 @@ final class Double256Vector extends DoubleVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java
index 77b52f511d6..e3473906864 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class Double512Vector extends DoubleVector {
                                     (Double512Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Double512Vector compress(VectorMask m) {
+        return (Double512Vector)
+            super.compressTemplate(Double512Mask.class,
+                                   (Double512Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Double512Vector expand(VectorMask m) {
+        return (Double512Vector)
+            super.expandTemplate(Double512Mask.class,
+                                   (Double512Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Double512Vector selectFrom(Vector v) {
@@ -650,6 +666,15 @@ final class Double512Vector extends DoubleVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Double512Mask compress() {
+            return (Double512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Double512Vector.class, Double512Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -842,29 +867,15 @@ final class Double512Vector extends DoubleVector {
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Double512Mask.class, a, offset, (Double512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Double512Mask.class, bb, offset, (Double512Mask) m);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Double512Mask.class, ms, offset, (Double512Mask) m);  // specialize
     }
 
     @ForceInline
@@ -892,22 +903,8 @@ final class Double512Vector extends DoubleVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Double512Mask.class, a, offset, (Double512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Double512Mask.class, bb, offset, (Double512Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Double512Mask.class, ms, offset, (Double512Mask) m);
     }
 
 
@@ -916,3 +913,4 @@ final class Double512Vector extends DoubleVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java
index dba680a6a3c..d07f2f0b7a0 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class Double64Vector extends DoubleVector {
                                     (Double64Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Double64Vector compress(VectorMask m) {
+        return (Double64Vector)
+            super.compressTemplate(Double64Mask.class,
+                                   (Double64Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Double64Vector expand(VectorMask m) {
+        return (Double64Vector)
+            super.expandTemplate(Double64Mask.class,
+                                   (Double64Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Double64Vector selectFrom(Vector v) {
@@ -636,6 +652,15 @@ final class Double64Vector extends DoubleVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Double64Mask compress() {
+            return (Double64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Double64Vector.class, Double64Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -828,29 +853,15 @@ final class Double64Vector extends DoubleVector {
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Double64Mask.class, a, offset, (Double64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Double64Mask.class, bb, offset, (Double64Mask) m);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Double64Mask.class, ms, offset, (Double64Mask) m);  // specialize
     }
 
     @ForceInline
@@ -878,22 +889,8 @@ final class Double64Vector extends DoubleVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Double64Mask.class, a, offset, (Double64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Double64Mask.class, bb, offset, (Double64Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Double64Mask.class, ms, offset, (Double64Mask) m);
     }
 
 
@@ -902,3 +899,4 @@ final class Double64Vector extends DoubleVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java
index 8c454d3f872..c33b9a31170 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class DoubleMaxVector extends DoubleVector {
                                     (DoubleMaxVector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public DoubleMaxVector compress(VectorMask m) {
+        return (DoubleMaxVector)
+            super.compressTemplate(DoubleMaxMask.class,
+                                   (DoubleMaxMask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public DoubleMaxVector expand(VectorMask m) {
+        return (DoubleMaxVector)
+            super.expandTemplate(DoubleMaxMask.class,
+                                   (DoubleMaxMask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public DoubleMaxVector selectFrom(Vector v) {
@@ -635,6 +651,15 @@ final class DoubleMaxVector extends DoubleVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public DoubleMaxMask compress() {
+            return (DoubleMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                DoubleMaxVector.class, DoubleMaxMask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -827,29 +852,15 @@ final class DoubleMaxVector extends DoubleVector {
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    DoubleVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(DoubleMaxMask.class, a, offset, (DoubleMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(DoubleMaxMask.class, bb, offset, (DoubleMaxMask) m);  // specialize
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(DoubleMaxMask.class, ms, offset, (DoubleMaxMask) m);  // specialize
     }
 
     @ForceInline
@@ -877,22 +888,8 @@ final class DoubleMaxVector extends DoubleVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(DoubleMaxMask.class, a, offset, (DoubleMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(DoubleMaxMask.class, bb, offset, (DoubleMaxMask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(DoubleMaxMask.class, ms, offset, (DoubleMaxMask) m);
     }
 
 
@@ -901,3 +898,4 @@ final class DoubleMaxVector extends DoubleVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java
index 4d62284bb6e..3401bbc7bc5 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java
@@ -24,14 +24,14 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
+import java.lang.foreign.ValueLayout;
 import java.nio.ByteOrder;
-import java.nio.ReadOnlyBufferException;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.Function;
-import java.util.function.UnaryOperator;
 
+import jdk.internal.foreign.AbstractMemorySegmentImpl;
 import jdk.internal.misc.ScopedMemoryAccess;
 import jdk.internal.misc.Unsafe;
 import jdk.internal.vm.annotation.ForceInline;
@@ -57,6 +57,8 @@ public abstract class DoubleVector extends AbstractVector {
 
     static final int FORBID_OPCODE_KIND = VO_NOFP;
 
+    static final ValueLayout.OfDouble ELEMENT_LAYOUT = ValueLayout.JAVA_DOUBLE.withBitAlignment(8);
+
     @ForceInline
     static int opCode(Operator op) {
         return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND);
@@ -351,6 +353,45 @@ public abstract class DoubleVector extends AbstractVector {
         return vectorFactory(res);
     }
 
+    /*package-private*/
+    interface FLdLongOp {
+        double apply(MemorySegment memory, long offset, int i);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    DoubleVector ldLongOp(MemorySegment memory, long offset,
+                                  FLdLongOp f) {
+        //dummy; no vec = vec();
+        double[] res = new double[length()];
+        for (int i = 0; i < res.length; i++) {
+            res[i] = f.apply(memory, offset, i);
+        }
+        return vectorFactory(res);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    DoubleVector ldLongOp(MemorySegment memory, long offset,
+                                  VectorMask m,
+                                  FLdLongOp f) {
+        //double[] vec = vec();
+        double[] res = new double[length()];
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < res.length; i++) {
+            if (mbits[i]) {
+                res[i] = f.apply(memory, offset, i);
+            }
+        }
+        return vectorFactory(res);
+    }
+
+    static double memorySegmentGet(MemorySegment ms, long o, int i) {
+        return ms.get(ELEMENT_LAYOUT, o + i * 8L);
+    }
+
     interface FStOp {
         void apply(M memory, int offset, int i, double a);
     }
@@ -381,6 +422,40 @@ public abstract class DoubleVector extends AbstractVector {
         }
     }
 
+    interface FStLongOp {
+        void apply(MemorySegment memory, long offset, int i, double a);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  FStLongOp f) {
+        double[] vec = vec();
+        for (int i = 0; i < vec.length; i++) {
+            f.apply(memory, offset, i, vec[i]);
+        }
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  VectorMask m,
+                  FStLongOp f) {
+        double[] vec = vec();
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < vec.length; i++) {
+            if (mbits[i]) {
+                f.apply(memory, offset, i, vec[i]);
+            }
+        }
+    }
+
+    static void memorySegmentSet(MemorySegment ms, long o, int i, double e) {
+        ms.set(ELEMENT_LAYOUT, o + i * 8L, e);
+    }
+
     // Binary test
 
     /*package-private*/
@@ -420,6 +495,36 @@ public abstract class DoubleVector extends AbstractVector {
         return Double.longBitsToDouble((long)bits);
     }
 
+    static DoubleVector expandHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        DoubleVector r  = (DoubleVector) vsp.zero();
+        DoubleVector vi = (DoubleVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(i, vi.lane(j++));
+            }
+        }
+        return r;
+    }
+
+    static DoubleVector compressHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        DoubleVector r  = (DoubleVector) vsp.zero();
+        DoubleVector vi = (DoubleVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(j++, vi.lane(i));
+            }
+        }
+        return r;
+    }
+
     // Static factories (other than memory operations)
 
     // Note: A surprising behavior in javadoc
@@ -1594,6 +1699,7 @@ public abstract class DoubleVector extends AbstractVector {
     }
 
 
+
     // sqrt
     /**
      * Computes the square root of this vector.
@@ -2241,6 +2347,45 @@ public abstract class DoubleVector extends AbstractVector {
                                      DoubleVector::toShuffle0);
     }
 
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    DoubleVector compress(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    DoubleVector compressTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (DoubleVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype,
+                                                        double.class, length(), this, m,
+                                                        (v1, m1) -> compressHelper(v1, m1));
+    }
+
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    DoubleVector expand(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    DoubleVector expandTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (DoubleVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype,
+                                                        double.class, length(), this, m,
+                                                        (v1, m1) -> expandHelper(v1, m1));
+    }
+
+
     /**
      * {@inheritDoc} 
      */
@@ -2609,90 +2754,6 @@ public abstract class DoubleVector extends AbstractVector {
         return toArray();
     }
 
-    /**
-     * Loads a vector from a byte array starting at an offset.
-     * Bytes are composed into primitive lane elements according
-     * to the specified byte order.
-     * The vector is arranged into lanes according to
-     * memory ordering.
-     * 

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - */ - @ForceInline - public static - DoubleVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), a.length); - DoubleSpecies vsp = (DoubleSpecies) species; - return vsp.dummyVector().fromByteArray0(a, offset).maybeSwap(bo); - } - - /** - * Loads a vector from a byte array starting at an offset - * and using a mask. - * Lanes where the mask is unset are filled with the default - * value of {@code double} (positive zero). - * Bytes are composed into primitive lane elements according - * to the specified byte order. - * The vector is arranged into lanes according to - * memory ordering. - *

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @param m the mask controlling lane selection - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - * where the mask is set - */ - @ForceInline - public static - DoubleVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo, - VectorMask m) { - DoubleSpecies vsp = (DoubleSpecies) species; - if (offset >= 0 && offset <= (a.length - species.vectorByteSize())) { - return vsp.dummyVector().fromByteArray0(a, offset, m).maybeSwap(bo); - } - - // FIXME: optimize - checkMaskFromIndexSize(offset, vsp, m, 8, a.length); - ByteBuffer wb = wrapper(a, bo); - return vsp.ldOp(wb, offset, (AbstractMask)m, - (wb_, o, i) -> wb_.getDouble(o + i * 8)); - } - /** * Loads a vector from an array of type {@code double[]} * starting at an offset. @@ -2883,44 +2944,49 @@ public abstract class DoubleVector extends AbstractVector { /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer. + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment. * Bytes are composed into primitive lane elements according * to the specified byte order. * The vector is arranged into lanes according to * memory ordering. *

* This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: + * {@link #fromMemorySegment(VectorSpecies,MemorySegment,long,ByteOrder,VectorMask) + * fromMemorySegment()} as follows: *

{@code
      * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
+     * return fromMemorySegment(species, ms, offset, bo, m);
      * }
* * @param species species of desired vector - * @param bb the byte buffer - * @param offset the offset into the byte buffer + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order - * @return a vector loaded from a byte buffer + * @return a vector loaded from the memory segment * @throws IndexOutOfBoundsException * if {@code offset+N*8 < 0} - * or {@code offset+N*8 >= bb.limit()} + * or {@code offset+N*8 >= ms.byteSize()} * for any lane {@code N} in the vector + * @throws IllegalArgumentException if the memory segment is a heap segment that is + * not backed by a {@code byte[]} array. + * @throws IllegalStateException if the memory segment's session is not alive, + * or if access occurs from a thread other than the thread owning the session. + * @since 19 */ @ForceInline public static - DoubleVector fromByteBuffer(VectorSpecies species, - ByteBuffer bb, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), bb.limit()); + DoubleVector fromMemorySegment(VectorSpecies species, + MemorySegment ms, long offset, + ByteOrder bo) { + offset = checkFromIndexSize(offset, species.vectorByteSize(), ms.byteSize()); DoubleSpecies vsp = (DoubleSpecies) species; - return vsp.dummyVector().fromByteBuffer0(bb, offset).maybeSwap(bo); + return vsp.dummyVector().fromMemorySegment0(ms, offset).maybeSwap(bo); } /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment * and using a mask. * Lanes where the mask is unset are filled with the default * value of {@code double} (positive zero). @@ -2931,13 +2997,11 @@ public abstract class DoubleVector extends AbstractVector { *

* The following pseudocode illustrates the behavior: *

{@code
-     * DoubleBuffer eb = bb.duplicate()
-     *     .position(offset)
-     *     .order(bo).asDoubleBuffer();
+     * var slice = ms.asSlice(offset);
      * double[] ar = new double[species.length()];
      * for (int n = 0; n < ar.length; n++) {
      *     if (m.laneIsSet(n)) {
-     *         ar[n] = eb.get(n);
+     *         ar[n] = slice.getAtIndex(ValuaLayout.JAVA_DOUBLE.withBitAlignment(8), n);
      *     }
      * }
      * DoubleVector r = DoubleVector.fromArray(species, ar, 0);
@@ -2951,33 +3015,36 @@ public abstract class DoubleVector extends AbstractVector {
      * the bytes of lane values.
      *
      * @param species species of desired vector
-     * @param bb the byte buffer
-     * @param offset the offset into the byte buffer
+     * @param ms the memory segment
+     * @param offset the offset into the memory segment
      * @param bo the intended byte order
      * @param m the mask controlling lane selection
-     * @return a vector loaded from a byte buffer
+     * @return a vector loaded from the memory segment
      * @throws IndexOutOfBoundsException
      *         if {@code offset+N*8 < 0}
-     *         or {@code offset+N*8 >= bb.limit()}
+     *         or {@code offset+N*8 >= ms.byteSize()}
      *         for any lane {@code N} in the vector
      *         where the mask is set
+     * @throws IllegalArgumentException if the memory segment is a heap segment that is
+     *         not backed by a {@code byte[]} array.
+     * @throws IllegalStateException if the memory segment's session is not alive,
+     *         or if access occurs from a thread other than the thread owning the session.
+     * @since 19
      */
     @ForceInline
     public static
-    DoubleVector fromByteBuffer(VectorSpecies species,
-                                        ByteBuffer bb, int offset,
-                                        ByteOrder bo,
-                                        VectorMask m) {
+    DoubleVector fromMemorySegment(VectorSpecies species,
+                                           MemorySegment ms, long offset,
+                                           ByteOrder bo,
+                                           VectorMask m) {
         DoubleSpecies vsp = (DoubleSpecies) species;
-        if (offset >= 0 && offset <= (bb.limit() - species.vectorByteSize())) {
-            return vsp.dummyVector().fromByteBuffer0(bb, offset, m).maybeSwap(bo);
+        if (offset >= 0 && offset <= (ms.byteSize() - species.vectorByteSize())) {
+            return vsp.dummyVector().fromMemorySegment0(ms, offset, m).maybeSwap(bo);
         }
 
         // FIXME: optimize
-        checkMaskFromIndexSize(offset, vsp, m, 8, bb.limit());
-        ByteBuffer wb = wrapper(bb, bo);
-        return vsp.ldOp(wb, offset, (AbstractMask)m,
-                   (wb_, o, i)  -> wb_.getDouble(o + i * 8));
+        checkMaskFromIndexSize(offset, vsp, m, 8, ms.byteSize());
+        return vsp.ldLongOp(ms, offset, m, DoubleVector::memorySegmentGet);
     }
 
     // Memory store operations
@@ -3007,7 +3074,7 @@ public abstract class DoubleVector extends AbstractVector {
             this,
             a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3167,67 +3234,40 @@ public abstract class DoubleVector extends AbstractVector {
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo) {
-        offset = checkFromIndexSize(offset, byteSize(), a.length);
-        maybeSwap(bo).intoByteArray0(a, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo,
-                       VectorMask m) {
-        if (m.allTrue()) {
-            intoByteArray(a, offset, bo);
-        } else {
-            DoubleSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 8, a.length);
-            maybeSwap(bo).intoByteArray0(a, offset, m);
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo) {
+        if (ms.isReadOnly()) {
+            throw new UnsupportedOperationException("Attempt to write a read-only segment");
         }
+
+        offset = checkFromIndexSize(offset, byteSize(), ms.byteSize());
+        maybeSwap(bo).intoMemorySegment0(ms, offset);
     }
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo) {
-        if (ScopedMemoryAccess.isReadOnly(bb)) {
-            throw new ReadOnlyBufferException();
-        }
-        offset = checkFromIndexSize(offset, byteSize(), bb.limit());
-        maybeSwap(bo).intoByteBuffer0(bb, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo,
-                        VectorMask m) {
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo,
+                           VectorMask m) {
         if (m.allTrue()) {
-            intoByteBuffer(bb, offset, bo);
+            intoMemorySegment(ms, offset, bo);
         } else {
-            if (bb.isReadOnly()) {
-                throw new ReadOnlyBufferException();
+            if (ms.isReadOnly()) {
+                throw new UnsupportedOperationException("Attempt to write a read-only segment");
             }
             DoubleSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 8, bb.limit());
-            maybeSwap(bo).intoByteBuffer0(bb, offset, m);
+            checkMaskFromIndexSize(offset, vsp, m, 8, ms.byteSize());
+            maybeSwap(bo).intoMemorySegment0(ms, offset, m);
         }
     }
 
@@ -3261,7 +3301,7 @@ public abstract class DoubleVector extends AbstractVector {
             vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset),
             a, offset, vsp,
-            (arr, off, s) -> s.ldOp(arr, off,
+            (arr, off, s) -> s.ldOp(arr, (int) off,
                                     (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3278,7 +3318,7 @@ public abstract class DoubleVector extends AbstractVector {
             vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset), m,
             a, offset, vsp,
-            (arr, off, s, vm) -> s.ldOp(arr, off, vm,
+            (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                         (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3336,74 +3376,33 @@ public abstract class DoubleVector extends AbstractVector {
 
 
 
-    @Override
     abstract
-    DoubleVector fromByteArray0(byte[] a, int offset);
+    DoubleVector fromMemorySegment0(MemorySegment bb, long offset);
     @ForceInline
     final
-    DoubleVector fromByteArray0Template(byte[] a, int offset) {
+    DoubleVector fromMemorySegment0Template(MemorySegment ms, long offset) {
         DoubleSpecies vsp = vspecies();
-        return VectorSupport.load(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            a, offset, vsp,
-            (arr, off, s) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off,
-                        (wb_, o, i) -> wb_.getDouble(o + i * 8));
-            });
-    }
-
-    abstract
-    DoubleVector fromByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    DoubleVector fromByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        DoubleSpecies vsp = vspecies();
-        m.check(vsp);
-        return VectorSupport.loadMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset), m,
-            a, offset, vsp,
-            (arr, off, s, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off, vm,
-                        (wb_, o, i) -> wb_.getDouble(o + i * 8));
-            });
-    }
-
-    abstract
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset);
-    @ForceInline
-    final
-    DoubleVector fromByteBuffer0Template(ByteBuffer bb, int offset) {
-        DoubleSpecies vsp = vspecies();
-        return ScopedMemoryAccess.loadFromByteBuffer(
+        return ScopedMemoryAccess.loadFromMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                bb, offset, vsp,
-                (buf, off, s) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off,
-                            (wb_, o, i) -> wb_.getDouble(o + i * 8));
+                (AbstractMemorySegmentImpl) ms, offset, vsp,
+                (msp, off, s) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, DoubleVector::memorySegmentGet);
                 });
     }
 
     abstract
-    DoubleVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    DoubleVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m);
     @ForceInline
     final
     >
-    DoubleVector fromByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    DoubleVector fromMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         DoubleSpecies vsp = vspecies();
         m.check(vsp);
-        return ScopedMemoryAccess.loadFromByteBufferMasked(
+        return ScopedMemoryAccess.loadFromMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                bb, offset, m, vsp,
-                (buf, off, s, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off, vm,
-                            (wb_, o, i) -> wb_.getDouble(o + i * 8));
+                (AbstractMemorySegmentImpl) ms, offset, m, vsp,
+                (msp, off, s, vm) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, vm, DoubleVector::memorySegmentGet);
                 });
     }
 
@@ -3422,7 +3421,7 @@ public abstract class DoubleVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_+i] = e));
     }
 
@@ -3439,7 +3438,7 @@ public abstract class DoubleVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, m, a, offset,
             (arr, off, v, vm)
-            -> v.stOp(arr, off, vm,
+            -> v.stOp(arr, (int) off, vm,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3497,71 +3496,33 @@ public abstract class DoubleVector extends AbstractVector {
     }
 
 
-    abstract
-    void intoByteArray0(byte[] a, int offset);
     @ForceInline
     final
-    void intoByteArray0Template(byte[] a, int offset) {
+    void intoMemorySegment0(MemorySegment ms, long offset) {
         DoubleSpecies vsp = vspecies();
-        VectorSupport.store(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, a, offset,
-            (arr, off, v) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off,
-                        (tb_, o, i, e) -> tb_.putDouble(o + i * 8, e));
-            });
-    }
-
-    abstract
-    void intoByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    void intoByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        DoubleSpecies vsp = vspecies();
-        m.check(vsp);
-        VectorSupport.storeMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, m, a, offset,
-            (arr, off, v, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off, vm,
-                        (tb_, o, i, e) -> tb_.putDouble(o + i * 8, e));
-            });
-    }
-
-    @ForceInline
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset) {
-        DoubleSpecies vsp = vspecies();
-        ScopedMemoryAccess.storeIntoByteBuffer(
+        ScopedMemoryAccess.storeIntoMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                this, bb, offset,
-                (buf, off, v) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off,
-                            (wb_, o, i, e) -> wb_.putDouble(o + i * 8, e));
+                this,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v) -> {
+                    v.stLongOp((MemorySegment) msp, off, DoubleVector::memorySegmentSet);
                 });
     }
 
     abstract
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    void intoMemorySegment0(MemorySegment bb, long offset, VectorMask m);
     @ForceInline
     final
     >
-    void intoByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    void intoMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         DoubleSpecies vsp = vspecies();
         m.check(vsp);
-        ScopedMemoryAccess.storeIntoByteBufferMasked(
+        ScopedMemoryAccess.storeIntoMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                this, m, bb, offset,
-                (buf, off, v, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off, vm,
-                            (wb_, o, i, e) -> wb_.putDouble(o + i * 8, e));
+                this, m,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v, vm) -> {
+                    v.stLongOp((MemorySegment) msp, off, vm, DoubleVector::memorySegmentSet);
                 });
     }
 
@@ -3578,6 +3539,16 @@ public abstract class DoubleVector extends AbstractVector {
             .checkIndexByLane(offset, limit, vsp.iota(), scale);
     }
 
+    private static
+    void checkMaskFromIndexSize(long offset,
+                                DoubleSpecies vsp,
+                                VectorMask m,
+                                int scale,
+                                long limit) {
+        ((AbstractMask)m)
+            .checkIndexByLane(offset, limit, vsp.iota(), scale);
+    }
+
     @ForceInline
     private void conditionalStoreNYI(int offset,
                                      DoubleSpecies vsp,
@@ -3888,6 +3859,21 @@ public abstract class DoubleVector extends AbstractVector {
             return dummyVector().ldOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        DoubleVector ldLongOp(MemorySegment memory, long offset,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        DoubleVector ldLongOp(MemorySegment memory, long offset,
+                                      VectorMask m,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, m, f);
+        }
+
         /*package-private*/
         @ForceInline
          void stOp(M memory, int offset, FStOp f) {
@@ -3902,6 +3888,20 @@ public abstract class DoubleVector extends AbstractVector {
             dummyVector().stOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset, FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset,
+                      AbstractMask m,
+                      FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, m, f);
+        }
+
         // N.B. Make sure these constant vectors and
         // masks load up correctly into registers.
         //
@@ -4015,3 +4015,4 @@ public abstract class DoubleVector extends AbstractVector {
     public static final VectorSpecies SPECIES_PREFERRED
         = (DoubleSpecies) VectorSpecies.ofPreferred(double.class);
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java
index 1d6195486ae..ae4fc4c21cc 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class Float128Vector extends FloatVector {
                                     (Float128Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Float128Vector compress(VectorMask m) {
+        return (Float128Vector)
+            super.compressTemplate(Float128Mask.class,
+                                   (Float128Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Float128Vector expand(VectorMask m) {
+        return (Float128Vector)
+            super.expandTemplate(Float128Mask.class,
+                                   (Float128Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Float128Vector selectFrom(Vector v) {
@@ -642,6 +658,15 @@ final class Float128Vector extends FloatVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Float128Mask compress() {
+            return (Float128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Float128Vector.class, Float128Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -834,29 +859,15 @@ final class Float128Vector extends FloatVector {
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Float128Mask.class, a, offset, (Float128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Float128Mask.class, bb, offset, (Float128Mask) m);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Float128Mask.class, ms, offset, (Float128Mask) m);  // specialize
     }
 
     @ForceInline
@@ -884,22 +895,8 @@ final class Float128Vector extends FloatVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Float128Mask.class, a, offset, (Float128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Float128Mask.class, bb, offset, (Float128Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Float128Mask.class, ms, offset, (Float128Mask) m);
     }
 
 
@@ -908,3 +905,4 @@ final class Float128Vector extends FloatVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java
index 6a2a1003cf4..93be418cd33 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class Float256Vector extends FloatVector {
                                     (Float256Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Float256Vector compress(VectorMask m) {
+        return (Float256Vector)
+            super.compressTemplate(Float256Mask.class,
+                                   (Float256Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Float256Vector expand(VectorMask m) {
+        return (Float256Vector)
+            super.expandTemplate(Float256Mask.class,
+                                   (Float256Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Float256Vector selectFrom(Vector v) {
@@ -650,6 +666,15 @@ final class Float256Vector extends FloatVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Float256Mask compress() {
+            return (Float256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Float256Vector.class, Float256Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -842,29 +867,15 @@ final class Float256Vector extends FloatVector {
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Float256Mask.class, a, offset, (Float256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Float256Mask.class, bb, offset, (Float256Mask) m);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Float256Mask.class, ms, offset, (Float256Mask) m);  // specialize
     }
 
     @ForceInline
@@ -892,22 +903,8 @@ final class Float256Vector extends FloatVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Float256Mask.class, a, offset, (Float256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Float256Mask.class, bb, offset, (Float256Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Float256Mask.class, ms, offset, (Float256Mask) m);
     }
 
 
@@ -916,3 +913,4 @@ final class Float256Vector extends FloatVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java
index 5b29c2cca10..5534c4abdbe 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class Float512Vector extends FloatVector {
                                     (Float512Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Float512Vector compress(VectorMask m) {
+        return (Float512Vector)
+            super.compressTemplate(Float512Mask.class,
+                                   (Float512Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Float512Vector expand(VectorMask m) {
+        return (Float512Vector)
+            super.expandTemplate(Float512Mask.class,
+                                   (Float512Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Float512Vector selectFrom(Vector v) {
@@ -666,6 +682,15 @@ final class Float512Vector extends FloatVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Float512Mask compress() {
+            return (Float512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Float512Vector.class, Float512Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -858,29 +883,15 @@ final class Float512Vector extends FloatVector {
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Float512Mask.class, a, offset, (Float512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Float512Mask.class, bb, offset, (Float512Mask) m);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Float512Mask.class, ms, offset, (Float512Mask) m);  // specialize
     }
 
     @ForceInline
@@ -908,22 +919,8 @@ final class Float512Vector extends FloatVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Float512Mask.class, a, offset, (Float512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Float512Mask.class, bb, offset, (Float512Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Float512Mask.class, ms, offset, (Float512Mask) m);
     }
 
 
@@ -932,3 +929,4 @@ final class Float512Vector extends FloatVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java
index 0eea80c244f..999a96c40f4 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class Float64Vector extends FloatVector {
                                     (Float64Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Float64Vector compress(VectorMask m) {
+        return (Float64Vector)
+            super.compressTemplate(Float64Mask.class,
+                                   (Float64Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Float64Vector expand(VectorMask m) {
+        return (Float64Vector)
+            super.expandTemplate(Float64Mask.class,
+                                   (Float64Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Float64Vector selectFrom(Vector v) {
@@ -638,6 +654,15 @@ final class Float64Vector extends FloatVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Float64Mask compress() {
+            return (Float64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Float64Vector.class, Float64Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -830,29 +855,15 @@ final class Float64Vector extends FloatVector {
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Float64Mask.class, a, offset, (Float64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Float64Mask.class, bb, offset, (Float64Mask) m);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Float64Mask.class, ms, offset, (Float64Mask) m);  // specialize
     }
 
     @ForceInline
@@ -880,22 +891,8 @@ final class Float64Vector extends FloatVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Float64Mask.class, a, offset, (Float64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Float64Mask.class, bb, offset, (Float64Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Float64Mask.class, ms, offset, (Float64Mask) m);
     }
 
 
@@ -904,3 +901,4 @@ final class Float64Vector extends FloatVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java
index 0db9aab9c57..3cce4fa0a69 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -461,6 +461,22 @@ final class FloatMaxVector extends FloatVector {
                                     (FloatMaxVector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public FloatMaxVector compress(VectorMask m) {
+        return (FloatMaxVector)
+            super.compressTemplate(FloatMaxMask.class,
+                                   (FloatMaxMask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public FloatMaxVector expand(VectorMask m) {
+        return (FloatMaxVector)
+            super.expandTemplate(FloatMaxMask.class,
+                                   (FloatMaxMask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public FloatMaxVector selectFrom(Vector v) {
@@ -635,6 +651,15 @@ final class FloatMaxVector extends FloatVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public FloatMaxMask compress() {
+            return (FloatMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                FloatMaxVector.class, FloatMaxMask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -827,29 +852,15 @@ final class FloatMaxVector extends FloatVector {
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    FloatVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(FloatMaxMask.class, a, offset, (FloatMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(FloatMaxMask.class, bb, offset, (FloatMaxMask) m);  // specialize
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(FloatMaxMask.class, ms, offset, (FloatMaxMask) m);  // specialize
     }
 
     @ForceInline
@@ -877,22 +888,8 @@ final class FloatMaxVector extends FloatVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(FloatMaxMask.class, a, offset, (FloatMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(FloatMaxMask.class, bb, offset, (FloatMaxMask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(FloatMaxMask.class, ms, offset, (FloatMaxMask) m);
     }
 
 
@@ -901,3 +898,4 @@ final class FloatMaxVector extends FloatVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java
index 60da7eb57fc..cbb01515756 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java
@@ -24,14 +24,14 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
+import java.lang.foreign.ValueLayout;
 import java.nio.ByteOrder;
-import java.nio.ReadOnlyBufferException;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.Function;
-import java.util.function.UnaryOperator;
 
+import jdk.internal.foreign.AbstractMemorySegmentImpl;
 import jdk.internal.misc.ScopedMemoryAccess;
 import jdk.internal.misc.Unsafe;
 import jdk.internal.vm.annotation.ForceInline;
@@ -57,6 +57,8 @@ public abstract class FloatVector extends AbstractVector {
 
     static final int FORBID_OPCODE_KIND = VO_NOFP;
 
+    static final ValueLayout.OfFloat ELEMENT_LAYOUT = ValueLayout.JAVA_FLOAT.withBitAlignment(8);
+
     @ForceInline
     static int opCode(Operator op) {
         return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND);
@@ -351,6 +353,45 @@ public abstract class FloatVector extends AbstractVector {
         return vectorFactory(res);
     }
 
+    /*package-private*/
+    interface FLdLongOp {
+        float apply(MemorySegment memory, long offset, int i);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    FloatVector ldLongOp(MemorySegment memory, long offset,
+                                  FLdLongOp f) {
+        //dummy; no vec = vec();
+        float[] res = new float[length()];
+        for (int i = 0; i < res.length; i++) {
+            res[i] = f.apply(memory, offset, i);
+        }
+        return vectorFactory(res);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    FloatVector ldLongOp(MemorySegment memory, long offset,
+                                  VectorMask m,
+                                  FLdLongOp f) {
+        //float[] vec = vec();
+        float[] res = new float[length()];
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < res.length; i++) {
+            if (mbits[i]) {
+                res[i] = f.apply(memory, offset, i);
+            }
+        }
+        return vectorFactory(res);
+    }
+
+    static float memorySegmentGet(MemorySegment ms, long o, int i) {
+        return ms.get(ELEMENT_LAYOUT, o + i * 4L);
+    }
+
     interface FStOp {
         void apply(M memory, int offset, int i, float a);
     }
@@ -381,6 +422,40 @@ public abstract class FloatVector extends AbstractVector {
         }
     }
 
+    interface FStLongOp {
+        void apply(MemorySegment memory, long offset, int i, float a);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  FStLongOp f) {
+        float[] vec = vec();
+        for (int i = 0; i < vec.length; i++) {
+            f.apply(memory, offset, i, vec[i]);
+        }
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  VectorMask m,
+                  FStLongOp f) {
+        float[] vec = vec();
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < vec.length; i++) {
+            if (mbits[i]) {
+                f.apply(memory, offset, i, vec[i]);
+            }
+        }
+    }
+
+    static void memorySegmentSet(MemorySegment ms, long o, int i, float e) {
+        ms.set(ELEMENT_LAYOUT, o + i * 4L, e);
+    }
+
     // Binary test
 
     /*package-private*/
@@ -420,6 +495,36 @@ public abstract class FloatVector extends AbstractVector {
         return Float.intBitsToFloat((int)bits);
     }
 
+    static FloatVector expandHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        FloatVector r  = (FloatVector) vsp.zero();
+        FloatVector vi = (FloatVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(i, vi.lane(j++));
+            }
+        }
+        return r;
+    }
+
+    static FloatVector compressHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        FloatVector r  = (FloatVector) vsp.zero();
+        FloatVector vi = (FloatVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(j++, vi.lane(i));
+            }
+        }
+        return r;
+    }
+
     // Static factories (other than memory operations)
 
     // Note: A surprising behavior in javadoc
@@ -1602,6 +1707,7 @@ public abstract class FloatVector extends AbstractVector {
     }
 
 
+
     // sqrt
     /**
      * Computes the square root of this vector.
@@ -2253,6 +2359,45 @@ public abstract class FloatVector extends AbstractVector {
                                      FloatVector::toShuffle0);
     }
 
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    FloatVector compress(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    FloatVector compressTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (FloatVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype,
+                                                        float.class, length(), this, m,
+                                                        (v1, m1) -> compressHelper(v1, m1));
+    }
+
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    FloatVector expand(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    FloatVector expandTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (FloatVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype,
+                                                        float.class, length(), this, m,
+                                                        (v1, m1) -> expandHelper(v1, m1));
+    }
+
+
     /**
      * {@inheritDoc} 
      */
@@ -2633,90 +2778,6 @@ public abstract class FloatVector extends AbstractVector {
         return res;
     }
 
-    /**
-     * Loads a vector from a byte array starting at an offset.
-     * Bytes are composed into primitive lane elements according
-     * to the specified byte order.
-     * The vector is arranged into lanes according to
-     * memory ordering.
-     * 

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - */ - @ForceInline - public static - FloatVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), a.length); - FloatSpecies vsp = (FloatSpecies) species; - return vsp.dummyVector().fromByteArray0(a, offset).maybeSwap(bo); - } - - /** - * Loads a vector from a byte array starting at an offset - * and using a mask. - * Lanes where the mask is unset are filled with the default - * value of {@code float} (positive zero). - * Bytes are composed into primitive lane elements according - * to the specified byte order. - * The vector is arranged into lanes according to - * memory ordering. - *

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @param m the mask controlling lane selection - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - * where the mask is set - */ - @ForceInline - public static - FloatVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo, - VectorMask m) { - FloatSpecies vsp = (FloatSpecies) species; - if (offset >= 0 && offset <= (a.length - species.vectorByteSize())) { - return vsp.dummyVector().fromByteArray0(a, offset, m).maybeSwap(bo); - } - - // FIXME: optimize - checkMaskFromIndexSize(offset, vsp, m, 4, a.length); - ByteBuffer wb = wrapper(a, bo); - return vsp.ldOp(wb, offset, (AbstractMask)m, - (wb_, o, i) -> wb_.getFloat(o + i * 4)); - } - /** * Loads a vector from an array of type {@code float[]} * starting at an offset. @@ -2889,44 +2950,49 @@ public abstract class FloatVector extends AbstractVector { /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer. + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment. * Bytes are composed into primitive lane elements according * to the specified byte order. * The vector is arranged into lanes according to * memory ordering. *

* This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: + * {@link #fromMemorySegment(VectorSpecies,MemorySegment,long,ByteOrder,VectorMask) + * fromMemorySegment()} as follows: *

{@code
      * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
+     * return fromMemorySegment(species, ms, offset, bo, m);
      * }
* * @param species species of desired vector - * @param bb the byte buffer - * @param offset the offset into the byte buffer + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order - * @return a vector loaded from a byte buffer + * @return a vector loaded from the memory segment * @throws IndexOutOfBoundsException * if {@code offset+N*4 < 0} - * or {@code offset+N*4 >= bb.limit()} + * or {@code offset+N*4 >= ms.byteSize()} * for any lane {@code N} in the vector + * @throws IllegalArgumentException if the memory segment is a heap segment that is + * not backed by a {@code byte[]} array. + * @throws IllegalStateException if the memory segment's session is not alive, + * or if access occurs from a thread other than the thread owning the session. + * @since 19 */ @ForceInline public static - FloatVector fromByteBuffer(VectorSpecies species, - ByteBuffer bb, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), bb.limit()); + FloatVector fromMemorySegment(VectorSpecies species, + MemorySegment ms, long offset, + ByteOrder bo) { + offset = checkFromIndexSize(offset, species.vectorByteSize(), ms.byteSize()); FloatSpecies vsp = (FloatSpecies) species; - return vsp.dummyVector().fromByteBuffer0(bb, offset).maybeSwap(bo); + return vsp.dummyVector().fromMemorySegment0(ms, offset).maybeSwap(bo); } /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment * and using a mask. * Lanes where the mask is unset are filled with the default * value of {@code float} (positive zero). @@ -2937,13 +3003,11 @@ public abstract class FloatVector extends AbstractVector { *

* The following pseudocode illustrates the behavior: *

{@code
-     * FloatBuffer eb = bb.duplicate()
-     *     .position(offset)
-     *     .order(bo).asFloatBuffer();
+     * var slice = ms.asSlice(offset);
      * float[] ar = new float[species.length()];
      * for (int n = 0; n < ar.length; n++) {
      *     if (m.laneIsSet(n)) {
-     *         ar[n] = eb.get(n);
+     *         ar[n] = slice.getAtIndex(ValuaLayout.JAVA_FLOAT.withBitAlignment(8), n);
      *     }
      * }
      * FloatVector r = FloatVector.fromArray(species, ar, 0);
@@ -2957,33 +3021,36 @@ public abstract class FloatVector extends AbstractVector {
      * the bytes of lane values.
      *
      * @param species species of desired vector
-     * @param bb the byte buffer
-     * @param offset the offset into the byte buffer
+     * @param ms the memory segment
+     * @param offset the offset into the memory segment
      * @param bo the intended byte order
      * @param m the mask controlling lane selection
-     * @return a vector loaded from a byte buffer
+     * @return a vector loaded from the memory segment
      * @throws IndexOutOfBoundsException
      *         if {@code offset+N*4 < 0}
-     *         or {@code offset+N*4 >= bb.limit()}
+     *         or {@code offset+N*4 >= ms.byteSize()}
      *         for any lane {@code N} in the vector
      *         where the mask is set
+     * @throws IllegalArgumentException if the memory segment is a heap segment that is
+     *         not backed by a {@code byte[]} array.
+     * @throws IllegalStateException if the memory segment's session is not alive,
+     *         or if access occurs from a thread other than the thread owning the session.
+     * @since 19
      */
     @ForceInline
     public static
-    FloatVector fromByteBuffer(VectorSpecies species,
-                                        ByteBuffer bb, int offset,
-                                        ByteOrder bo,
-                                        VectorMask m) {
+    FloatVector fromMemorySegment(VectorSpecies species,
+                                           MemorySegment ms, long offset,
+                                           ByteOrder bo,
+                                           VectorMask m) {
         FloatSpecies vsp = (FloatSpecies) species;
-        if (offset >= 0 && offset <= (bb.limit() - species.vectorByteSize())) {
-            return vsp.dummyVector().fromByteBuffer0(bb, offset, m).maybeSwap(bo);
+        if (offset >= 0 && offset <= (ms.byteSize() - species.vectorByteSize())) {
+            return vsp.dummyVector().fromMemorySegment0(ms, offset, m).maybeSwap(bo);
         }
 
         // FIXME: optimize
-        checkMaskFromIndexSize(offset, vsp, m, 4, bb.limit());
-        ByteBuffer wb = wrapper(bb, bo);
-        return vsp.ldOp(wb, offset, (AbstractMask)m,
-                   (wb_, o, i)  -> wb_.getFloat(o + i * 4));
+        checkMaskFromIndexSize(offset, vsp, m, 4, ms.byteSize());
+        return vsp.ldLongOp(ms, offset, m, FloatVector::memorySegmentGet);
     }
 
     // Memory store operations
@@ -3013,7 +3080,7 @@ public abstract class FloatVector extends AbstractVector {
             this,
             a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3154,67 +3221,40 @@ public abstract class FloatVector extends AbstractVector {
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo) {
-        offset = checkFromIndexSize(offset, byteSize(), a.length);
-        maybeSwap(bo).intoByteArray0(a, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo,
-                       VectorMask m) {
-        if (m.allTrue()) {
-            intoByteArray(a, offset, bo);
-        } else {
-            FloatSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 4, a.length);
-            maybeSwap(bo).intoByteArray0(a, offset, m);
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo) {
+        if (ms.isReadOnly()) {
+            throw new UnsupportedOperationException("Attempt to write a read-only segment");
         }
+
+        offset = checkFromIndexSize(offset, byteSize(), ms.byteSize());
+        maybeSwap(bo).intoMemorySegment0(ms, offset);
     }
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo) {
-        if (ScopedMemoryAccess.isReadOnly(bb)) {
-            throw new ReadOnlyBufferException();
-        }
-        offset = checkFromIndexSize(offset, byteSize(), bb.limit());
-        maybeSwap(bo).intoByteBuffer0(bb, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo,
-                        VectorMask m) {
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo,
+                           VectorMask m) {
         if (m.allTrue()) {
-            intoByteBuffer(bb, offset, bo);
+            intoMemorySegment(ms, offset, bo);
         } else {
-            if (bb.isReadOnly()) {
-                throw new ReadOnlyBufferException();
+            if (ms.isReadOnly()) {
+                throw new UnsupportedOperationException("Attempt to write a read-only segment");
             }
             FloatSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 4, bb.limit());
-            maybeSwap(bo).intoByteBuffer0(bb, offset, m);
+            checkMaskFromIndexSize(offset, vsp, m, 4, ms.byteSize());
+            maybeSwap(bo).intoMemorySegment0(ms, offset, m);
         }
     }
 
@@ -3248,7 +3288,7 @@ public abstract class FloatVector extends AbstractVector {
             vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset),
             a, offset, vsp,
-            (arr, off, s) -> s.ldOp(arr, off,
+            (arr, off, s) -> s.ldOp(arr, (int) off,
                                     (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3265,7 +3305,7 @@ public abstract class FloatVector extends AbstractVector {
             vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset), m,
             a, offset, vsp,
-            (arr, off, s, vm) -> s.ldOp(arr, off, vm,
+            (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                         (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3305,74 +3345,33 @@ public abstract class FloatVector extends AbstractVector {
 
 
 
-    @Override
     abstract
-    FloatVector fromByteArray0(byte[] a, int offset);
+    FloatVector fromMemorySegment0(MemorySegment bb, long offset);
     @ForceInline
     final
-    FloatVector fromByteArray0Template(byte[] a, int offset) {
+    FloatVector fromMemorySegment0Template(MemorySegment ms, long offset) {
         FloatSpecies vsp = vspecies();
-        return VectorSupport.load(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            a, offset, vsp,
-            (arr, off, s) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off,
-                        (wb_, o, i) -> wb_.getFloat(o + i * 4));
-            });
-    }
-
-    abstract
-    FloatVector fromByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    FloatVector fromByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        FloatSpecies vsp = vspecies();
-        m.check(vsp);
-        return VectorSupport.loadMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset), m,
-            a, offset, vsp,
-            (arr, off, s, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off, vm,
-                        (wb_, o, i) -> wb_.getFloat(o + i * 4));
-            });
-    }
-
-    abstract
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset);
-    @ForceInline
-    final
-    FloatVector fromByteBuffer0Template(ByteBuffer bb, int offset) {
-        FloatSpecies vsp = vspecies();
-        return ScopedMemoryAccess.loadFromByteBuffer(
+        return ScopedMemoryAccess.loadFromMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                bb, offset, vsp,
-                (buf, off, s) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off,
-                            (wb_, o, i) -> wb_.getFloat(o + i * 4));
+                (AbstractMemorySegmentImpl) ms, offset, vsp,
+                (msp, off, s) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, FloatVector::memorySegmentGet);
                 });
     }
 
     abstract
-    FloatVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    FloatVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m);
     @ForceInline
     final
     >
-    FloatVector fromByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    FloatVector fromMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         FloatSpecies vsp = vspecies();
         m.check(vsp);
-        return ScopedMemoryAccess.loadFromByteBufferMasked(
+        return ScopedMemoryAccess.loadFromMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                bb, offset, m, vsp,
-                (buf, off, s, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off, vm,
-                            (wb_, o, i) -> wb_.getFloat(o + i * 4));
+                (AbstractMemorySegmentImpl) ms, offset, m, vsp,
+                (msp, off, s, vm) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, vm, FloatVector::memorySegmentGet);
                 });
     }
 
@@ -3391,7 +3390,7 @@ public abstract class FloatVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_+i] = e));
     }
 
@@ -3408,7 +3407,7 @@ public abstract class FloatVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, m, a, offset,
             (arr, off, v, vm)
-            -> v.stOp(arr, off, vm,
+            -> v.stOp(arr, (int) off, vm,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3447,71 +3446,33 @@ public abstract class FloatVector extends AbstractVector {
     }
 
 
-    abstract
-    void intoByteArray0(byte[] a, int offset);
     @ForceInline
     final
-    void intoByteArray0Template(byte[] a, int offset) {
+    void intoMemorySegment0(MemorySegment ms, long offset) {
         FloatSpecies vsp = vspecies();
-        VectorSupport.store(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, a, offset,
-            (arr, off, v) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off,
-                        (tb_, o, i, e) -> tb_.putFloat(o + i * 4, e));
-            });
-    }
-
-    abstract
-    void intoByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    void intoByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        FloatSpecies vsp = vspecies();
-        m.check(vsp);
-        VectorSupport.storeMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, m, a, offset,
-            (arr, off, v, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off, vm,
-                        (tb_, o, i, e) -> tb_.putFloat(o + i * 4, e));
-            });
-    }
-
-    @ForceInline
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset) {
-        FloatSpecies vsp = vspecies();
-        ScopedMemoryAccess.storeIntoByteBuffer(
+        ScopedMemoryAccess.storeIntoMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                this, bb, offset,
-                (buf, off, v) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off,
-                            (wb_, o, i, e) -> wb_.putFloat(o + i * 4, e));
+                this,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v) -> {
+                    v.stLongOp((MemorySegment) msp, off, FloatVector::memorySegmentSet);
                 });
     }
 
     abstract
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    void intoMemorySegment0(MemorySegment bb, long offset, VectorMask m);
     @ForceInline
     final
     >
-    void intoByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    void intoMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         FloatSpecies vsp = vspecies();
         m.check(vsp);
-        ScopedMemoryAccess.storeIntoByteBufferMasked(
+        ScopedMemoryAccess.storeIntoMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                this, m, bb, offset,
-                (buf, off, v, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off, vm,
-                            (wb_, o, i, e) -> wb_.putFloat(o + i * 4, e));
+                this, m,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v, vm) -> {
+                    v.stLongOp((MemorySegment) msp, off, vm, FloatVector::memorySegmentSet);
                 });
     }
 
@@ -3528,6 +3489,16 @@ public abstract class FloatVector extends AbstractVector {
             .checkIndexByLane(offset, limit, vsp.iota(), scale);
     }
 
+    private static
+    void checkMaskFromIndexSize(long offset,
+                                FloatSpecies vsp,
+                                VectorMask m,
+                                int scale,
+                                long limit) {
+        ((AbstractMask)m)
+            .checkIndexByLane(offset, limit, vsp.iota(), scale);
+    }
+
     @ForceInline
     private void conditionalStoreNYI(int offset,
                                      FloatSpecies vsp,
@@ -3838,6 +3809,21 @@ public abstract class FloatVector extends AbstractVector {
             return dummyVector().ldOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        FloatVector ldLongOp(MemorySegment memory, long offset,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        FloatVector ldLongOp(MemorySegment memory, long offset,
+                                      VectorMask m,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, m, f);
+        }
+
         /*package-private*/
         @ForceInline
          void stOp(M memory, int offset, FStOp f) {
@@ -3852,6 +3838,20 @@ public abstract class FloatVector extends AbstractVector {
             dummyVector().stOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset, FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset,
+                      AbstractMask m,
+                      FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, m, f);
+        }
+
         // N.B. Make sure these constant vectors and
         // masks load up correctly into registers.
         //
@@ -3965,3 +3965,4 @@ public abstract class FloatVector extends AbstractVector {
     public static final VectorSpecies SPECIES_PREFERRED
         = (FloatSpecies) VectorSpecies.ofPreferred(float.class);
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java
index 3baf712aa7c..df05f7e88a5 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class Int128Vector extends IntVector {
                                     (Int128Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Int128Vector compress(VectorMask m) {
+        return (Int128Vector)
+            super.compressTemplate(Int128Mask.class,
+                                   (Int128Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Int128Vector expand(VectorMask m) {
+        return (Int128Vector)
+            super.expandTemplate(Int128Mask.class,
+                                   (Int128Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Int128Vector selectFrom(Vector v) {
@@ -653,6 +669,15 @@ final class Int128Vector extends IntVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Int128Mask compress() {
+            return (Int128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Int128Vector.class, Int128Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -845,29 +870,15 @@ final class Int128Vector extends IntVector {
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Int128Mask.class, a, offset, (Int128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Int128Mask.class, bb, offset, (Int128Mask) m);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Int128Mask.class, ms, offset, (Int128Mask) m);  // specialize
     }
 
     @ForceInline
@@ -895,22 +906,8 @@ final class Int128Vector extends IntVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Int128Mask.class, a, offset, (Int128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Int128Mask.class, bb, offset, (Int128Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Int128Mask.class, ms, offset, (Int128Mask) m);
     }
 
 
@@ -919,3 +916,4 @@ final class Int128Vector extends IntVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java
index a82f1cf1d07..85c727063c9 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class Int256Vector extends IntVector {
                                     (Int256Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Int256Vector compress(VectorMask m) {
+        return (Int256Vector)
+            super.compressTemplate(Int256Mask.class,
+                                   (Int256Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Int256Vector expand(VectorMask m) {
+        return (Int256Vector)
+            super.expandTemplate(Int256Mask.class,
+                                   (Int256Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Int256Vector selectFrom(Vector v) {
@@ -661,6 +677,15 @@ final class Int256Vector extends IntVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Int256Mask compress() {
+            return (Int256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Int256Vector.class, Int256Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -853,29 +878,15 @@ final class Int256Vector extends IntVector {
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Int256Mask.class, a, offset, (Int256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Int256Mask.class, bb, offset, (Int256Mask) m);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Int256Mask.class, ms, offset, (Int256Mask) m);  // specialize
     }
 
     @ForceInline
@@ -903,22 +914,8 @@ final class Int256Vector extends IntVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Int256Mask.class, a, offset, (Int256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Int256Mask.class, bb, offset, (Int256Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Int256Mask.class, ms, offset, (Int256Mask) m);
     }
 
 
@@ -927,3 +924,4 @@ final class Int256Vector extends IntVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java
index 40b7246b63f..d86d3ac60e8 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class Int512Vector extends IntVector {
                                     (Int512Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Int512Vector compress(VectorMask m) {
+        return (Int512Vector)
+            super.compressTemplate(Int512Mask.class,
+                                   (Int512Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Int512Vector expand(VectorMask m) {
+        return (Int512Vector)
+            super.expandTemplate(Int512Mask.class,
+                                   (Int512Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Int512Vector selectFrom(Vector v) {
@@ -677,6 +693,15 @@ final class Int512Vector extends IntVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Int512Mask compress() {
+            return (Int512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Int512Vector.class, Int512Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -869,29 +894,15 @@ final class Int512Vector extends IntVector {
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Int512Mask.class, a, offset, (Int512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Int512Mask.class, bb, offset, (Int512Mask) m);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Int512Mask.class, ms, offset, (Int512Mask) m);  // specialize
     }
 
     @ForceInline
@@ -919,22 +930,8 @@ final class Int512Vector extends IntVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Int512Mask.class, a, offset, (Int512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Int512Mask.class, bb, offset, (Int512Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Int512Mask.class, ms, offset, (Int512Mask) m);
     }
 
 
@@ -943,3 +940,4 @@ final class Int512Vector extends IntVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java
index 59c54a6007b..a83b96c41a8 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class Int64Vector extends IntVector {
                                     (Int64Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Int64Vector compress(VectorMask m) {
+        return (Int64Vector)
+            super.compressTemplate(Int64Mask.class,
+                                   (Int64Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Int64Vector expand(VectorMask m) {
+        return (Int64Vector)
+            super.expandTemplate(Int64Mask.class,
+                                   (Int64Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Int64Vector selectFrom(Vector v) {
@@ -649,6 +665,15 @@ final class Int64Vector extends IntVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Int64Mask compress() {
+            return (Int64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Int64Vector.class, Int64Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -841,29 +866,15 @@ final class Int64Vector extends IntVector {
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Int64Mask.class, a, offset, (Int64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Int64Mask.class, bb, offset, (Int64Mask) m);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Int64Mask.class, ms, offset, (Int64Mask) m);  // specialize
     }
 
     @ForceInline
@@ -891,22 +902,8 @@ final class Int64Vector extends IntVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Int64Mask.class, a, offset, (Int64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Int64Mask.class, bb, offset, (Int64Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Int64Mask.class, ms, offset, (Int64Mask) m);
     }
 
 
@@ -915,3 +912,4 @@ final class Int64Vector extends IntVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java
index 58588448c06..7a19f874acd 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class IntMaxVector extends IntVector {
                                     (IntMaxVector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public IntMaxVector compress(VectorMask m) {
+        return (IntMaxVector)
+            super.compressTemplate(IntMaxMask.class,
+                                   (IntMaxMask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public IntMaxVector expand(VectorMask m) {
+        return (IntMaxVector)
+            super.expandTemplate(IntMaxMask.class,
+                                   (IntMaxMask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public IntMaxVector selectFrom(Vector v) {
@@ -647,6 +663,15 @@ final class IntMaxVector extends IntVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public IntMaxMask compress() {
+            return (IntMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                IntMaxVector.class, IntMaxMask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -850,29 +875,15 @@ final class IntMaxVector extends IntVector {
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    IntVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(IntMaxMask.class, a, offset, (IntMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(IntMaxMask.class, bb, offset, (IntMaxMask) m);  // specialize
+    IntVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(IntMaxMask.class, ms, offset, (IntMaxMask) m);  // specialize
     }
 
     @ForceInline
@@ -900,22 +911,8 @@ final class IntMaxVector extends IntVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(IntMaxMask.class, a, offset, (IntMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(IntMaxMask.class, bb, offset, (IntMaxMask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(IntMaxMask.class, ms, offset, (IntMaxMask) m);
     }
 
 
@@ -924,3 +921,4 @@ final class IntMaxVector extends IntVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java
index c1d2f418574..30fd78e7709 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java
@@ -24,14 +24,14 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
+import java.lang.foreign.ValueLayout;
 import java.nio.ByteOrder;
-import java.nio.ReadOnlyBufferException;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.Function;
-import java.util.function.UnaryOperator;
 
+import jdk.internal.foreign.AbstractMemorySegmentImpl;
 import jdk.internal.misc.ScopedMemoryAccess;
 import jdk.internal.misc.Unsafe;
 import jdk.internal.vm.annotation.ForceInline;
@@ -57,6 +57,8 @@ public abstract class IntVector extends AbstractVector {
 
     static final int FORBID_OPCODE_KIND = VO_ONLYFP;
 
+    static final ValueLayout.OfInt ELEMENT_LAYOUT = ValueLayout.JAVA_INT.withBitAlignment(8);
+
     @ForceInline
     static int opCode(Operator op) {
         return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND);
@@ -351,6 +353,45 @@ public abstract class IntVector extends AbstractVector {
         return vectorFactory(res);
     }
 
+    /*package-private*/
+    interface FLdLongOp {
+        int apply(MemorySegment memory, long offset, int i);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    IntVector ldLongOp(MemorySegment memory, long offset,
+                                  FLdLongOp f) {
+        //dummy; no vec = vec();
+        int[] res = new int[length()];
+        for (int i = 0; i < res.length; i++) {
+            res[i] = f.apply(memory, offset, i);
+        }
+        return vectorFactory(res);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    IntVector ldLongOp(MemorySegment memory, long offset,
+                                  VectorMask m,
+                                  FLdLongOp f) {
+        //int[] vec = vec();
+        int[] res = new int[length()];
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < res.length; i++) {
+            if (mbits[i]) {
+                res[i] = f.apply(memory, offset, i);
+            }
+        }
+        return vectorFactory(res);
+    }
+
+    static int memorySegmentGet(MemorySegment ms, long o, int i) {
+        return ms.get(ELEMENT_LAYOUT, o + i * 4L);
+    }
+
     interface FStOp {
         void apply(M memory, int offset, int i, int a);
     }
@@ -381,6 +422,40 @@ public abstract class IntVector extends AbstractVector {
         }
     }
 
+    interface FStLongOp {
+        void apply(MemorySegment memory, long offset, int i, int a);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  FStLongOp f) {
+        int[] vec = vec();
+        for (int i = 0; i < vec.length; i++) {
+            f.apply(memory, offset, i, vec[i]);
+        }
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  VectorMask m,
+                  FStLongOp f) {
+        int[] vec = vec();
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < vec.length; i++) {
+            if (mbits[i]) {
+                f.apply(memory, offset, i, vec[i]);
+            }
+        }
+    }
+
+    static void memorySegmentSet(MemorySegment ms, long o, int i, int e) {
+        ms.set(ELEMENT_LAYOUT, o + i * 4L, e);
+    }
+
     // Binary test
 
     /*package-private*/
@@ -431,6 +506,36 @@ public abstract class IntVector extends AbstractVector {
         return ((int)bits);
     }
 
+    static IntVector expandHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        IntVector r  = (IntVector) vsp.zero();
+        IntVector vi = (IntVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(i, vi.lane(j++));
+            }
+        }
+        return r;
+    }
+
+    static IntVector compressHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        IntVector r  = (IntVector) vsp.zero();
+        IntVector vi = (IntVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(j++, vi.lane(i));
+            }
+        }
+        return r;
+    }
+
     // Static factories (other than memory operations)
 
     // Note: A surprising behavior in javadoc
@@ -620,6 +725,16 @@ public abstract class IntVector extends AbstractVector {
                     v0.uOp(m, (i, a) -> (int) -a);
             case VECTOR_OP_ABS: return (v0, m) ->
                     v0.uOp(m, (i, a) -> (int) Math.abs(a));
+            case VECTOR_OP_BIT_COUNT: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (int) Integer.bitCount(a));
+            case VECTOR_OP_TZ_COUNT: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (int) Integer.numberOfTrailingZeros(a));
+            case VECTOR_OP_LZ_COUNT: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (int) Integer.numberOfLeadingZeros(a));
+            case VECTOR_OP_REVERSE: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (int) Integer.reverse(a));
+            case VECTOR_OP_REVERSE_BYTES: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (int) Integer.reverseBytes(a));
             default: return null;
         }
     }
@@ -760,6 +875,10 @@ public abstract class IntVector extends AbstractVector {
                     v0.bOp(v1, vm, (i, a, n) -> rotateLeft(a, (int)n));
             case VECTOR_OP_RROTATE: return (v0, v1, vm) ->
                     v0.bOp(v1, vm, (i, a, n) -> rotateRight(a, (int)n));
+            case VECTOR_OP_COMPRESS_BITS: return (v0, v1, vm) ->
+                    v0.bOp(v1, vm, (i, a, n) -> Integer.compress(a, n));
+            case VECTOR_OP_EXPAND_BITS: return (v0, v1, vm) ->
+                    v0.bOp(v1, vm, (i, a, n) -> Integer.expand(a, n));
             default: return null;
         }
     }
@@ -1745,6 +1864,7 @@ public abstract class IntVector extends AbstractVector {
         return lanewise(ABS);
     }
 
+
     // not (~)
     /**
      * Computes the bitwise logical complement ({@code ~})
@@ -2371,6 +2491,45 @@ public abstract class IntVector extends AbstractVector {
                                      IntVector::toShuffle0);
     }
 
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    IntVector compress(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    IntVector compressTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (IntVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype,
+                                                        int.class, length(), this, m,
+                                                        (v1, m1) -> compressHelper(v1, m1));
+    }
+
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    IntVector expand(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    IntVector expandTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (IntVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype,
+                                                        int.class, length(), this, m,
+                                                        (v1, m1) -> expandHelper(v1, m1));
+    }
+
+
     /**
      * {@inheritDoc} 
      */
@@ -2776,90 +2935,6 @@ public abstract class IntVector extends AbstractVector {
         return res;
     }
 
-    /**
-     * Loads a vector from a byte array starting at an offset.
-     * Bytes are composed into primitive lane elements according
-     * to the specified byte order.
-     * The vector is arranged into lanes according to
-     * memory ordering.
-     * 

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - */ - @ForceInline - public static - IntVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), a.length); - IntSpecies vsp = (IntSpecies) species; - return vsp.dummyVector().fromByteArray0(a, offset).maybeSwap(bo); - } - - /** - * Loads a vector from a byte array starting at an offset - * and using a mask. - * Lanes where the mask is unset are filled with the default - * value of {@code int} (zero). - * Bytes are composed into primitive lane elements according - * to the specified byte order. - * The vector is arranged into lanes according to - * memory ordering. - *

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @param m the mask controlling lane selection - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - * where the mask is set - */ - @ForceInline - public static - IntVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo, - VectorMask m) { - IntSpecies vsp = (IntSpecies) species; - if (offset >= 0 && offset <= (a.length - species.vectorByteSize())) { - return vsp.dummyVector().fromByteArray0(a, offset, m).maybeSwap(bo); - } - - // FIXME: optimize - checkMaskFromIndexSize(offset, vsp, m, 4, a.length); - ByteBuffer wb = wrapper(a, bo); - return vsp.ldOp(wb, offset, (AbstractMask)m, - (wb_, o, i) -> wb_.getInt(o + i * 4)); - } - /** * Loads a vector from an array of type {@code int[]} * starting at an offset. @@ -3032,44 +3107,49 @@ public abstract class IntVector extends AbstractVector { /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer. + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment. * Bytes are composed into primitive lane elements according * to the specified byte order. * The vector is arranged into lanes according to * memory ordering. *

* This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: + * {@link #fromMemorySegment(VectorSpecies,MemorySegment,long,ByteOrder,VectorMask) + * fromMemorySegment()} as follows: *

{@code
      * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
+     * return fromMemorySegment(species, ms, offset, bo, m);
      * }
* * @param species species of desired vector - * @param bb the byte buffer - * @param offset the offset into the byte buffer + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order - * @return a vector loaded from a byte buffer + * @return a vector loaded from the memory segment * @throws IndexOutOfBoundsException * if {@code offset+N*4 < 0} - * or {@code offset+N*4 >= bb.limit()} + * or {@code offset+N*4 >= ms.byteSize()} * for any lane {@code N} in the vector + * @throws IllegalArgumentException if the memory segment is a heap segment that is + * not backed by a {@code byte[]} array. + * @throws IllegalStateException if the memory segment's session is not alive, + * or if access occurs from a thread other than the thread owning the session. + * @since 19 */ @ForceInline public static - IntVector fromByteBuffer(VectorSpecies species, - ByteBuffer bb, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), bb.limit()); + IntVector fromMemorySegment(VectorSpecies species, + MemorySegment ms, long offset, + ByteOrder bo) { + offset = checkFromIndexSize(offset, species.vectorByteSize(), ms.byteSize()); IntSpecies vsp = (IntSpecies) species; - return vsp.dummyVector().fromByteBuffer0(bb, offset).maybeSwap(bo); + return vsp.dummyVector().fromMemorySegment0(ms, offset).maybeSwap(bo); } /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment * and using a mask. * Lanes where the mask is unset are filled with the default * value of {@code int} (zero). @@ -3080,13 +3160,11 @@ public abstract class IntVector extends AbstractVector { *

* The following pseudocode illustrates the behavior: *

{@code
-     * IntBuffer eb = bb.duplicate()
-     *     .position(offset)
-     *     .order(bo).asIntBuffer();
+     * var slice = ms.asSlice(offset);
      * int[] ar = new int[species.length()];
      * for (int n = 0; n < ar.length; n++) {
      *     if (m.laneIsSet(n)) {
-     *         ar[n] = eb.get(n);
+     *         ar[n] = slice.getAtIndex(ValuaLayout.JAVA_INT.withBitAlignment(8), n);
      *     }
      * }
      * IntVector r = IntVector.fromArray(species, ar, 0);
@@ -3100,33 +3178,36 @@ public abstract class IntVector extends AbstractVector {
      * the bytes of lane values.
      *
      * @param species species of desired vector
-     * @param bb the byte buffer
-     * @param offset the offset into the byte buffer
+     * @param ms the memory segment
+     * @param offset the offset into the memory segment
      * @param bo the intended byte order
      * @param m the mask controlling lane selection
-     * @return a vector loaded from a byte buffer
+     * @return a vector loaded from the memory segment
      * @throws IndexOutOfBoundsException
      *         if {@code offset+N*4 < 0}
-     *         or {@code offset+N*4 >= bb.limit()}
+     *         or {@code offset+N*4 >= ms.byteSize()}
      *         for any lane {@code N} in the vector
      *         where the mask is set
+     * @throws IllegalArgumentException if the memory segment is a heap segment that is
+     *         not backed by a {@code byte[]} array.
+     * @throws IllegalStateException if the memory segment's session is not alive,
+     *         or if access occurs from a thread other than the thread owning the session.
+     * @since 19
      */
     @ForceInline
     public static
-    IntVector fromByteBuffer(VectorSpecies species,
-                                        ByteBuffer bb, int offset,
-                                        ByteOrder bo,
-                                        VectorMask m) {
+    IntVector fromMemorySegment(VectorSpecies species,
+                                           MemorySegment ms, long offset,
+                                           ByteOrder bo,
+                                           VectorMask m) {
         IntSpecies vsp = (IntSpecies) species;
-        if (offset >= 0 && offset <= (bb.limit() - species.vectorByteSize())) {
-            return vsp.dummyVector().fromByteBuffer0(bb, offset, m).maybeSwap(bo);
+        if (offset >= 0 && offset <= (ms.byteSize() - species.vectorByteSize())) {
+            return vsp.dummyVector().fromMemorySegment0(ms, offset, m).maybeSwap(bo);
         }
 
         // FIXME: optimize
-        checkMaskFromIndexSize(offset, vsp, m, 4, bb.limit());
-        ByteBuffer wb = wrapper(bb, bo);
-        return vsp.ldOp(wb, offset, (AbstractMask)m,
-                   (wb_, o, i)  -> wb_.getInt(o + i * 4));
+        checkMaskFromIndexSize(offset, vsp, m, 4, ms.byteSize());
+        return vsp.ldLongOp(ms, offset, m, IntVector::memorySegmentGet);
     }
 
     // Memory store operations
@@ -3156,7 +3237,7 @@ public abstract class IntVector extends AbstractVector {
             this,
             a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3297,67 +3378,40 @@ public abstract class IntVector extends AbstractVector {
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo) {
-        offset = checkFromIndexSize(offset, byteSize(), a.length);
-        maybeSwap(bo).intoByteArray0(a, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo,
-                       VectorMask m) {
-        if (m.allTrue()) {
-            intoByteArray(a, offset, bo);
-        } else {
-            IntSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 4, a.length);
-            maybeSwap(bo).intoByteArray0(a, offset, m);
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo) {
+        if (ms.isReadOnly()) {
+            throw new UnsupportedOperationException("Attempt to write a read-only segment");
         }
+
+        offset = checkFromIndexSize(offset, byteSize(), ms.byteSize());
+        maybeSwap(bo).intoMemorySegment0(ms, offset);
     }
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo) {
-        if (ScopedMemoryAccess.isReadOnly(bb)) {
-            throw new ReadOnlyBufferException();
-        }
-        offset = checkFromIndexSize(offset, byteSize(), bb.limit());
-        maybeSwap(bo).intoByteBuffer0(bb, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo,
-                        VectorMask m) {
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo,
+                           VectorMask m) {
         if (m.allTrue()) {
-            intoByteBuffer(bb, offset, bo);
+            intoMemorySegment(ms, offset, bo);
         } else {
-            if (bb.isReadOnly()) {
-                throw new ReadOnlyBufferException();
+            if (ms.isReadOnly()) {
+                throw new UnsupportedOperationException("Attempt to write a read-only segment");
             }
             IntSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 4, bb.limit());
-            maybeSwap(bo).intoByteBuffer0(bb, offset, m);
+            checkMaskFromIndexSize(offset, vsp, m, 4, ms.byteSize());
+            maybeSwap(bo).intoMemorySegment0(ms, offset, m);
         }
     }
 
@@ -3391,7 +3445,7 @@ public abstract class IntVector extends AbstractVector {
             vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset),
             a, offset, vsp,
-            (arr, off, s) -> s.ldOp(arr, off,
+            (arr, off, s) -> s.ldOp(arr, (int) off,
                                     (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3408,7 +3462,7 @@ public abstract class IntVector extends AbstractVector {
             vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset), m,
             a, offset, vsp,
-            (arr, off, s, vm) -> s.ldOp(arr, off, vm,
+            (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                         (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3448,74 +3502,33 @@ public abstract class IntVector extends AbstractVector {
 
 
 
-    @Override
     abstract
-    IntVector fromByteArray0(byte[] a, int offset);
+    IntVector fromMemorySegment0(MemorySegment bb, long offset);
     @ForceInline
     final
-    IntVector fromByteArray0Template(byte[] a, int offset) {
+    IntVector fromMemorySegment0Template(MemorySegment ms, long offset) {
         IntSpecies vsp = vspecies();
-        return VectorSupport.load(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            a, offset, vsp,
-            (arr, off, s) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off,
-                        (wb_, o, i) -> wb_.getInt(o + i * 4));
-            });
-    }
-
-    abstract
-    IntVector fromByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    IntVector fromByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        IntSpecies vsp = vspecies();
-        m.check(vsp);
-        return VectorSupport.loadMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset), m,
-            a, offset, vsp,
-            (arr, off, s, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off, vm,
-                        (wb_, o, i) -> wb_.getInt(o + i * 4));
-            });
-    }
-
-    abstract
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset);
-    @ForceInline
-    final
-    IntVector fromByteBuffer0Template(ByteBuffer bb, int offset) {
-        IntSpecies vsp = vspecies();
-        return ScopedMemoryAccess.loadFromByteBuffer(
+        return ScopedMemoryAccess.loadFromMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                bb, offset, vsp,
-                (buf, off, s) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off,
-                            (wb_, o, i) -> wb_.getInt(o + i * 4));
+                (AbstractMemorySegmentImpl) ms, offset, vsp,
+                (msp, off, s) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, IntVector::memorySegmentGet);
                 });
     }
 
     abstract
-    IntVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    IntVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m);
     @ForceInline
     final
     >
-    IntVector fromByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    IntVector fromMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         IntSpecies vsp = vspecies();
         m.check(vsp);
-        return ScopedMemoryAccess.loadFromByteBufferMasked(
+        return ScopedMemoryAccess.loadFromMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                bb, offset, m, vsp,
-                (buf, off, s, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off, vm,
-                            (wb_, o, i) -> wb_.getInt(o + i * 4));
+                (AbstractMemorySegmentImpl) ms, offset, m, vsp,
+                (msp, off, s, vm) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, vm, IntVector::memorySegmentGet);
                 });
     }
 
@@ -3534,7 +3547,7 @@ public abstract class IntVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_+i] = e));
     }
 
@@ -3551,7 +3564,7 @@ public abstract class IntVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, m, a, offset,
             (arr, off, v, vm)
-            -> v.stOp(arr, off, vm,
+            -> v.stOp(arr, (int) off, vm,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3590,71 +3603,33 @@ public abstract class IntVector extends AbstractVector {
     }
 
 
-    abstract
-    void intoByteArray0(byte[] a, int offset);
     @ForceInline
     final
-    void intoByteArray0Template(byte[] a, int offset) {
+    void intoMemorySegment0(MemorySegment ms, long offset) {
         IntSpecies vsp = vspecies();
-        VectorSupport.store(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, a, offset,
-            (arr, off, v) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off,
-                        (tb_, o, i, e) -> tb_.putInt(o + i * 4, e));
-            });
-    }
-
-    abstract
-    void intoByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    void intoByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        IntSpecies vsp = vspecies();
-        m.check(vsp);
-        VectorSupport.storeMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, m, a, offset,
-            (arr, off, v, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off, vm,
-                        (tb_, o, i, e) -> tb_.putInt(o + i * 4, e));
-            });
-    }
-
-    @ForceInline
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset) {
-        IntSpecies vsp = vspecies();
-        ScopedMemoryAccess.storeIntoByteBuffer(
+        ScopedMemoryAccess.storeIntoMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                this, bb, offset,
-                (buf, off, v) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off,
-                            (wb_, o, i, e) -> wb_.putInt(o + i * 4, e));
+                this,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v) -> {
+                    v.stLongOp((MemorySegment) msp, off, IntVector::memorySegmentSet);
                 });
     }
 
     abstract
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    void intoMemorySegment0(MemorySegment bb, long offset, VectorMask m);
     @ForceInline
     final
     >
-    void intoByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    void intoMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         IntSpecies vsp = vspecies();
         m.check(vsp);
-        ScopedMemoryAccess.storeIntoByteBufferMasked(
+        ScopedMemoryAccess.storeIntoMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                this, m, bb, offset,
-                (buf, off, v, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off, vm,
-                            (wb_, o, i, e) -> wb_.putInt(o + i * 4, e));
+                this, m,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v, vm) -> {
+                    v.stLongOp((MemorySegment) msp, off, vm, IntVector::memorySegmentSet);
                 });
     }
 
@@ -3671,6 +3646,16 @@ public abstract class IntVector extends AbstractVector {
             .checkIndexByLane(offset, limit, vsp.iota(), scale);
     }
 
+    private static
+    void checkMaskFromIndexSize(long offset,
+                                IntSpecies vsp,
+                                VectorMask m,
+                                int scale,
+                                long limit) {
+        ((AbstractMask)m)
+            .checkIndexByLane(offset, limit, vsp.iota(), scale);
+    }
+
     @ForceInline
     private void conditionalStoreNYI(int offset,
                                      IntSpecies vsp,
@@ -3981,6 +3966,21 @@ public abstract class IntVector extends AbstractVector {
             return dummyVector().ldOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        IntVector ldLongOp(MemorySegment memory, long offset,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        IntVector ldLongOp(MemorySegment memory, long offset,
+                                      VectorMask m,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, m, f);
+        }
+
         /*package-private*/
         @ForceInline
          void stOp(M memory, int offset, FStOp f) {
@@ -3995,6 +3995,20 @@ public abstract class IntVector extends AbstractVector {
             dummyVector().stOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset, FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset,
+                      AbstractMask m,
+                      FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, m, f);
+        }
+
         // N.B. Make sure these constant vectors and
         // masks load up correctly into registers.
         //
@@ -4108,3 +4122,4 @@ public abstract class IntVector extends AbstractVector {
     public static final VectorSpecies SPECIES_PREFERRED
         = (IntSpecies) VectorSpecies.ofPreferred(int.class);
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java
index 7a11c0005a4..c4ca59950c8 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -464,6 +464,22 @@ final class Long128Vector extends LongVector {
                                     (Long128Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Long128Vector compress(VectorMask m) {
+        return (Long128Vector)
+            super.compressTemplate(Long128Mask.class,
+                                   (Long128Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Long128Vector expand(VectorMask m) {
+        return (Long128Vector)
+            super.expandTemplate(Long128Mask.class,
+                                   (Long128Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Long128Vector selectFrom(Vector v) {
@@ -639,6 +655,15 @@ final class Long128Vector extends LongVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Long128Mask compress() {
+            return (Long128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Long128Vector.class, Long128Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -831,29 +856,15 @@ final class Long128Vector extends LongVector {
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Long128Mask.class, a, offset, (Long128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Long128Mask.class, bb, offset, (Long128Mask) m);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Long128Mask.class, ms, offset, (Long128Mask) m);  // specialize
     }
 
     @ForceInline
@@ -881,22 +892,8 @@ final class Long128Vector extends LongVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Long128Mask.class, a, offset, (Long128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Long128Mask.class, bb, offset, (Long128Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Long128Mask.class, ms, offset, (Long128Mask) m);
     }
 
 
@@ -905,3 +902,4 @@ final class Long128Vector extends LongVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java
index ad4057dc070..3ebc15f273c 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -464,6 +464,22 @@ final class Long256Vector extends LongVector {
                                     (Long256Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Long256Vector compress(VectorMask m) {
+        return (Long256Vector)
+            super.compressTemplate(Long256Mask.class,
+                                   (Long256Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Long256Vector expand(VectorMask m) {
+        return (Long256Vector)
+            super.expandTemplate(Long256Mask.class,
+                                   (Long256Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Long256Vector selectFrom(Vector v) {
@@ -643,6 +659,15 @@ final class Long256Vector extends LongVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Long256Mask compress() {
+            return (Long256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Long256Vector.class, Long256Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -835,29 +860,15 @@ final class Long256Vector extends LongVector {
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Long256Mask.class, a, offset, (Long256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Long256Mask.class, bb, offset, (Long256Mask) m);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Long256Mask.class, ms, offset, (Long256Mask) m);  // specialize
     }
 
     @ForceInline
@@ -885,22 +896,8 @@ final class Long256Vector extends LongVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Long256Mask.class, a, offset, (Long256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Long256Mask.class, bb, offset, (Long256Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Long256Mask.class, ms, offset, (Long256Mask) m);
     }
 
 
@@ -909,3 +906,4 @@ final class Long256Vector extends LongVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java
index 6f7bee397a1..ee83e18662e 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -464,6 +464,22 @@ final class Long512Vector extends LongVector {
                                     (Long512Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Long512Vector compress(VectorMask m) {
+        return (Long512Vector)
+            super.compressTemplate(Long512Mask.class,
+                                   (Long512Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Long512Vector expand(VectorMask m) {
+        return (Long512Vector)
+            super.expandTemplate(Long512Mask.class,
+                                   (Long512Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Long512Vector selectFrom(Vector v) {
@@ -651,6 +667,15 @@ final class Long512Vector extends LongVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Long512Mask compress() {
+            return (Long512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Long512Vector.class, Long512Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -843,29 +868,15 @@ final class Long512Vector extends LongVector {
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Long512Mask.class, a, offset, (Long512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Long512Mask.class, bb, offset, (Long512Mask) m);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Long512Mask.class, ms, offset, (Long512Mask) m);  // specialize
     }
 
     @ForceInline
@@ -893,22 +904,8 @@ final class Long512Vector extends LongVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Long512Mask.class, a, offset, (Long512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Long512Mask.class, bb, offset, (Long512Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Long512Mask.class, ms, offset, (Long512Mask) m);
     }
 
 
@@ -917,3 +914,4 @@ final class Long512Vector extends LongVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java
index e7ab1241f4e..c67617287b2 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -464,6 +464,22 @@ final class Long64Vector extends LongVector {
                                     (Long64Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Long64Vector compress(VectorMask m) {
+        return (Long64Vector)
+            super.compressTemplate(Long64Mask.class,
+                                   (Long64Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Long64Vector expand(VectorMask m) {
+        return (Long64Vector)
+            super.expandTemplate(Long64Mask.class,
+                                   (Long64Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Long64Vector selectFrom(Vector v) {
@@ -637,6 +653,15 @@ final class Long64Vector extends LongVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Long64Mask compress() {
+            return (Long64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Long64Vector.class, Long64Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -829,29 +854,15 @@ final class Long64Vector extends LongVector {
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Long64Mask.class, a, offset, (Long64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Long64Mask.class, bb, offset, (Long64Mask) m);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Long64Mask.class, ms, offset, (Long64Mask) m);  // specialize
     }
 
     @ForceInline
@@ -879,22 +890,8 @@ final class Long64Vector extends LongVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Long64Mask.class, a, offset, (Long64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Long64Mask.class, bb, offset, (Long64Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Long64Mask.class, ms, offset, (Long64Mask) m);
     }
 
 
@@ -903,3 +900,4 @@ final class Long64Vector extends LongVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java
index 56ce68f1fc3..a2e58e6deee 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -464,6 +464,22 @@ final class LongMaxVector extends LongVector {
                                     (LongMaxVector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public LongMaxVector compress(VectorMask m) {
+        return (LongMaxVector)
+            super.compressTemplate(LongMaxMask.class,
+                                   (LongMaxMask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public LongMaxVector expand(VectorMask m) {
+        return (LongMaxVector)
+            super.expandTemplate(LongMaxMask.class,
+                                   (LongMaxMask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public LongMaxVector selectFrom(Vector v) {
@@ -637,6 +653,15 @@ final class LongMaxVector extends LongVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public LongMaxMask compress() {
+            return (LongMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                LongMaxVector.class, LongMaxMask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -829,29 +854,15 @@ final class LongMaxVector extends LongVector {
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    LongVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(LongMaxMask.class, a, offset, (LongMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(LongMaxMask.class, bb, offset, (LongMaxMask) m);  // specialize
+    LongVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(LongMaxMask.class, ms, offset, (LongMaxMask) m);  // specialize
     }
 
     @ForceInline
@@ -879,22 +890,8 @@ final class LongMaxVector extends LongVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(LongMaxMask.class, a, offset, (LongMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(LongMaxMask.class, bb, offset, (LongMaxMask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(LongMaxMask.class, ms, offset, (LongMaxMask) m);
     }
 
 
@@ -903,3 +900,4 @@ final class LongMaxVector extends LongVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java
index 60821caa6bd..36c6754e749 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java
@@ -24,14 +24,14 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
+import java.lang.foreign.ValueLayout;
 import java.nio.ByteOrder;
-import java.nio.ReadOnlyBufferException;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.Function;
-import java.util.function.UnaryOperator;
 
+import jdk.internal.foreign.AbstractMemorySegmentImpl;
 import jdk.internal.misc.ScopedMemoryAccess;
 import jdk.internal.misc.Unsafe;
 import jdk.internal.vm.annotation.ForceInline;
@@ -57,6 +57,8 @@ public abstract class LongVector extends AbstractVector {
 
     static final int FORBID_OPCODE_KIND = VO_ONLYFP;
 
+    static final ValueLayout.OfLong ELEMENT_LAYOUT = ValueLayout.JAVA_LONG.withBitAlignment(8);
+
     @ForceInline
     static int opCode(Operator op) {
         return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND);
@@ -351,6 +353,45 @@ public abstract class LongVector extends AbstractVector {
         return vectorFactory(res);
     }
 
+    /*package-private*/
+    interface FLdLongOp {
+        long apply(MemorySegment memory, long offset, int i);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    LongVector ldLongOp(MemorySegment memory, long offset,
+                                  FLdLongOp f) {
+        //dummy; no vec = vec();
+        long[] res = new long[length()];
+        for (int i = 0; i < res.length; i++) {
+            res[i] = f.apply(memory, offset, i);
+        }
+        return vectorFactory(res);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    LongVector ldLongOp(MemorySegment memory, long offset,
+                                  VectorMask m,
+                                  FLdLongOp f) {
+        //long[] vec = vec();
+        long[] res = new long[length()];
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < res.length; i++) {
+            if (mbits[i]) {
+                res[i] = f.apply(memory, offset, i);
+            }
+        }
+        return vectorFactory(res);
+    }
+
+    static long memorySegmentGet(MemorySegment ms, long o, int i) {
+        return ms.get(ELEMENT_LAYOUT, o + i * 8L);
+    }
+
     interface FStOp {
         void apply(M memory, int offset, int i, long a);
     }
@@ -381,6 +422,40 @@ public abstract class LongVector extends AbstractVector {
         }
     }
 
+    interface FStLongOp {
+        void apply(MemorySegment memory, long offset, int i, long a);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  FStLongOp f) {
+        long[] vec = vec();
+        for (int i = 0; i < vec.length; i++) {
+            f.apply(memory, offset, i, vec[i]);
+        }
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  VectorMask m,
+                  FStLongOp f) {
+        long[] vec = vec();
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < vec.length; i++) {
+            if (mbits[i]) {
+                f.apply(memory, offset, i, vec[i]);
+            }
+        }
+    }
+
+    static void memorySegmentSet(MemorySegment ms, long o, int i, long e) {
+        ms.set(ELEMENT_LAYOUT, o + i * 8L, e);
+    }
+
     // Binary test
 
     /*package-private*/
@@ -431,6 +506,36 @@ public abstract class LongVector extends AbstractVector {
         return ((long)bits);
     }
 
+    static LongVector expandHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        LongVector r  = (LongVector) vsp.zero();
+        LongVector vi = (LongVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(i, vi.lane(j++));
+            }
+        }
+        return r;
+    }
+
+    static LongVector compressHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        LongVector r  = (LongVector) vsp.zero();
+        LongVector vi = (LongVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(j++, vi.lane(i));
+            }
+        }
+        return r;
+    }
+
     // Static factories (other than memory operations)
 
     // Note: A surprising behavior in javadoc
@@ -578,6 +683,16 @@ public abstract class LongVector extends AbstractVector {
                     v0.uOp(m, (i, a) -> (long) -a);
             case VECTOR_OP_ABS: return (v0, m) ->
                     v0.uOp(m, (i, a) -> (long) Math.abs(a));
+            case VECTOR_OP_BIT_COUNT: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (long) Long.bitCount(a));
+            case VECTOR_OP_TZ_COUNT: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (long) Long.numberOfTrailingZeros(a));
+            case VECTOR_OP_LZ_COUNT: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (long) Long.numberOfLeadingZeros(a));
+            case VECTOR_OP_REVERSE: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (long) Long.reverse(a));
+            case VECTOR_OP_REVERSE_BYTES: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (long) Long.reverseBytes(a));
             default: return null;
         }
     }
@@ -718,6 +833,10 @@ public abstract class LongVector extends AbstractVector {
                     v0.bOp(v1, vm, (i, a, n) -> rotateLeft(a, (int)n));
             case VECTOR_OP_RROTATE: return (v0, v1, vm) ->
                     v0.bOp(v1, vm, (i, a, n) -> rotateRight(a, (int)n));
+            case VECTOR_OP_COMPRESS_BITS: return (v0, v1, vm) ->
+                    v0.bOp(v1, vm, (i, a, n) -> Long.compress(a, n));
+            case VECTOR_OP_EXPAND_BITS: return (v0, v1, vm) ->
+                    v0.bOp(v1, vm, (i, a, n) -> Long.expand(a, n));
             default: return null;
         }
     }
@@ -1658,6 +1777,7 @@ public abstract class LongVector extends AbstractVector {
         return lanewise(ABS);
     }
 
+
     // not (~)
     /**
      * Computes the bitwise logical complement ({@code ~})
@@ -2237,6 +2357,45 @@ public abstract class LongVector extends AbstractVector {
                                      LongVector::toShuffle0);
     }
 
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    LongVector compress(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    LongVector compressTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (LongVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype,
+                                                        long.class, length(), this, m,
+                                                        (v1, m1) -> compressHelper(v1, m1));
+    }
+
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    LongVector expand(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    LongVector expandTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (LongVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype,
+                                                        long.class, length(), this, m,
+                                                        (v1, m1) -> expandHelper(v1, m1));
+    }
+
+
     /**
      * {@inheritDoc} 
      */
@@ -2637,90 +2796,6 @@ public abstract class LongVector extends AbstractVector {
         return res;
     }
 
-    /**
-     * Loads a vector from a byte array starting at an offset.
-     * Bytes are composed into primitive lane elements according
-     * to the specified byte order.
-     * The vector is arranged into lanes according to
-     * memory ordering.
-     * 

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - */ - @ForceInline - public static - LongVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), a.length); - LongSpecies vsp = (LongSpecies) species; - return vsp.dummyVector().fromByteArray0(a, offset).maybeSwap(bo); - } - - /** - * Loads a vector from a byte array starting at an offset - * and using a mask. - * Lanes where the mask is unset are filled with the default - * value of {@code long} (zero). - * Bytes are composed into primitive lane elements according - * to the specified byte order. - * The vector is arranged into lanes according to - * memory ordering. - *

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @param m the mask controlling lane selection - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - * where the mask is set - */ - @ForceInline - public static - LongVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo, - VectorMask m) { - LongSpecies vsp = (LongSpecies) species; - if (offset >= 0 && offset <= (a.length - species.vectorByteSize())) { - return vsp.dummyVector().fromByteArray0(a, offset, m).maybeSwap(bo); - } - - // FIXME: optimize - checkMaskFromIndexSize(offset, vsp, m, 8, a.length); - ByteBuffer wb = wrapper(a, bo); - return vsp.ldOp(wb, offset, (AbstractMask)m, - (wb_, o, i) -> wb_.getLong(o + i * 8)); - } - /** * Loads a vector from an array of type {@code long[]} * starting at an offset. @@ -2911,44 +2986,49 @@ public abstract class LongVector extends AbstractVector { /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer. + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment. * Bytes are composed into primitive lane elements according * to the specified byte order. * The vector is arranged into lanes according to * memory ordering. *

* This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: + * {@link #fromMemorySegment(VectorSpecies,MemorySegment,long,ByteOrder,VectorMask) + * fromMemorySegment()} as follows: *

{@code
      * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
+     * return fromMemorySegment(species, ms, offset, bo, m);
      * }
* * @param species species of desired vector - * @param bb the byte buffer - * @param offset the offset into the byte buffer + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order - * @return a vector loaded from a byte buffer + * @return a vector loaded from the memory segment * @throws IndexOutOfBoundsException * if {@code offset+N*8 < 0} - * or {@code offset+N*8 >= bb.limit()} + * or {@code offset+N*8 >= ms.byteSize()} * for any lane {@code N} in the vector + * @throws IllegalArgumentException if the memory segment is a heap segment that is + * not backed by a {@code byte[]} array. + * @throws IllegalStateException if the memory segment's session is not alive, + * or if access occurs from a thread other than the thread owning the session. + * @since 19 */ @ForceInline public static - LongVector fromByteBuffer(VectorSpecies species, - ByteBuffer bb, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), bb.limit()); + LongVector fromMemorySegment(VectorSpecies species, + MemorySegment ms, long offset, + ByteOrder bo) { + offset = checkFromIndexSize(offset, species.vectorByteSize(), ms.byteSize()); LongSpecies vsp = (LongSpecies) species; - return vsp.dummyVector().fromByteBuffer0(bb, offset).maybeSwap(bo); + return vsp.dummyVector().fromMemorySegment0(ms, offset).maybeSwap(bo); } /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment * and using a mask. * Lanes where the mask is unset are filled with the default * value of {@code long} (zero). @@ -2959,13 +3039,11 @@ public abstract class LongVector extends AbstractVector { *

* The following pseudocode illustrates the behavior: *

{@code
-     * LongBuffer eb = bb.duplicate()
-     *     .position(offset)
-     *     .order(bo).asLongBuffer();
+     * var slice = ms.asSlice(offset);
      * long[] ar = new long[species.length()];
      * for (int n = 0; n < ar.length; n++) {
      *     if (m.laneIsSet(n)) {
-     *         ar[n] = eb.get(n);
+     *         ar[n] = slice.getAtIndex(ValuaLayout.JAVA_LONG.withBitAlignment(8), n);
      *     }
      * }
      * LongVector r = LongVector.fromArray(species, ar, 0);
@@ -2979,33 +3057,36 @@ public abstract class LongVector extends AbstractVector {
      * the bytes of lane values.
      *
      * @param species species of desired vector
-     * @param bb the byte buffer
-     * @param offset the offset into the byte buffer
+     * @param ms the memory segment
+     * @param offset the offset into the memory segment
      * @param bo the intended byte order
      * @param m the mask controlling lane selection
-     * @return a vector loaded from a byte buffer
+     * @return a vector loaded from the memory segment
      * @throws IndexOutOfBoundsException
      *         if {@code offset+N*8 < 0}
-     *         or {@code offset+N*8 >= bb.limit()}
+     *         or {@code offset+N*8 >= ms.byteSize()}
      *         for any lane {@code N} in the vector
      *         where the mask is set
+     * @throws IllegalArgumentException if the memory segment is a heap segment that is
+     *         not backed by a {@code byte[]} array.
+     * @throws IllegalStateException if the memory segment's session is not alive,
+     *         or if access occurs from a thread other than the thread owning the session.
+     * @since 19
      */
     @ForceInline
     public static
-    LongVector fromByteBuffer(VectorSpecies species,
-                                        ByteBuffer bb, int offset,
-                                        ByteOrder bo,
-                                        VectorMask m) {
+    LongVector fromMemorySegment(VectorSpecies species,
+                                           MemorySegment ms, long offset,
+                                           ByteOrder bo,
+                                           VectorMask m) {
         LongSpecies vsp = (LongSpecies) species;
-        if (offset >= 0 && offset <= (bb.limit() - species.vectorByteSize())) {
-            return vsp.dummyVector().fromByteBuffer0(bb, offset, m).maybeSwap(bo);
+        if (offset >= 0 && offset <= (ms.byteSize() - species.vectorByteSize())) {
+            return vsp.dummyVector().fromMemorySegment0(ms, offset, m).maybeSwap(bo);
         }
 
         // FIXME: optimize
-        checkMaskFromIndexSize(offset, vsp, m, 8, bb.limit());
-        ByteBuffer wb = wrapper(bb, bo);
-        return vsp.ldOp(wb, offset, (AbstractMask)m,
-                   (wb_, o, i)  -> wb_.getLong(o + i * 8));
+        checkMaskFromIndexSize(offset, vsp, m, 8, ms.byteSize());
+        return vsp.ldLongOp(ms, offset, m, LongVector::memorySegmentGet);
     }
 
     // Memory store operations
@@ -3035,7 +3116,7 @@ public abstract class LongVector extends AbstractVector {
             this,
             a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3195,67 +3276,40 @@ public abstract class LongVector extends AbstractVector {
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo) {
-        offset = checkFromIndexSize(offset, byteSize(), a.length);
-        maybeSwap(bo).intoByteArray0(a, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo,
-                       VectorMask m) {
-        if (m.allTrue()) {
-            intoByteArray(a, offset, bo);
-        } else {
-            LongSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 8, a.length);
-            maybeSwap(bo).intoByteArray0(a, offset, m);
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo) {
+        if (ms.isReadOnly()) {
+            throw new UnsupportedOperationException("Attempt to write a read-only segment");
         }
+
+        offset = checkFromIndexSize(offset, byteSize(), ms.byteSize());
+        maybeSwap(bo).intoMemorySegment0(ms, offset);
     }
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo) {
-        if (ScopedMemoryAccess.isReadOnly(bb)) {
-            throw new ReadOnlyBufferException();
-        }
-        offset = checkFromIndexSize(offset, byteSize(), bb.limit());
-        maybeSwap(bo).intoByteBuffer0(bb, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo,
-                        VectorMask m) {
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo,
+                           VectorMask m) {
         if (m.allTrue()) {
-            intoByteBuffer(bb, offset, bo);
+            intoMemorySegment(ms, offset, bo);
         } else {
-            if (bb.isReadOnly()) {
-                throw new ReadOnlyBufferException();
+            if (ms.isReadOnly()) {
+                throw new UnsupportedOperationException("Attempt to write a read-only segment");
             }
             LongSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 8, bb.limit());
-            maybeSwap(bo).intoByteBuffer0(bb, offset, m);
+            checkMaskFromIndexSize(offset, vsp, m, 8, ms.byteSize());
+            maybeSwap(bo).intoMemorySegment0(ms, offset, m);
         }
     }
 
@@ -3289,7 +3343,7 @@ public abstract class LongVector extends AbstractVector {
             vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset),
             a, offset, vsp,
-            (arr, off, s) -> s.ldOp(arr, off,
+            (arr, off, s) -> s.ldOp(arr, (int) off,
                                     (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3306,7 +3360,7 @@ public abstract class LongVector extends AbstractVector {
             vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset), m,
             a, offset, vsp,
-            (arr, off, s, vm) -> s.ldOp(arr, off, vm,
+            (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                         (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3364,74 +3418,33 @@ public abstract class LongVector extends AbstractVector {
 
 
 
-    @Override
     abstract
-    LongVector fromByteArray0(byte[] a, int offset);
+    LongVector fromMemorySegment0(MemorySegment bb, long offset);
     @ForceInline
     final
-    LongVector fromByteArray0Template(byte[] a, int offset) {
+    LongVector fromMemorySegment0Template(MemorySegment ms, long offset) {
         LongSpecies vsp = vspecies();
-        return VectorSupport.load(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            a, offset, vsp,
-            (arr, off, s) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off,
-                        (wb_, o, i) -> wb_.getLong(o + i * 8));
-            });
-    }
-
-    abstract
-    LongVector fromByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    LongVector fromByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        LongSpecies vsp = vspecies();
-        m.check(vsp);
-        return VectorSupport.loadMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset), m,
-            a, offset, vsp,
-            (arr, off, s, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off, vm,
-                        (wb_, o, i) -> wb_.getLong(o + i * 8));
-            });
-    }
-
-    abstract
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset);
-    @ForceInline
-    final
-    LongVector fromByteBuffer0Template(ByteBuffer bb, int offset) {
-        LongSpecies vsp = vspecies();
-        return ScopedMemoryAccess.loadFromByteBuffer(
+        return ScopedMemoryAccess.loadFromMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                bb, offset, vsp,
-                (buf, off, s) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off,
-                            (wb_, o, i) -> wb_.getLong(o + i * 8));
+                (AbstractMemorySegmentImpl) ms, offset, vsp,
+                (msp, off, s) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, LongVector::memorySegmentGet);
                 });
     }
 
     abstract
-    LongVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    LongVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m);
     @ForceInline
     final
     >
-    LongVector fromByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    LongVector fromMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         LongSpecies vsp = vspecies();
         m.check(vsp);
-        return ScopedMemoryAccess.loadFromByteBufferMasked(
+        return ScopedMemoryAccess.loadFromMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                bb, offset, m, vsp,
-                (buf, off, s, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off, vm,
-                            (wb_, o, i) -> wb_.getLong(o + i * 8));
+                (AbstractMemorySegmentImpl) ms, offset, m, vsp,
+                (msp, off, s, vm) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, vm, LongVector::memorySegmentGet);
                 });
     }
 
@@ -3450,7 +3463,7 @@ public abstract class LongVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_+i] = e));
     }
 
@@ -3467,7 +3480,7 @@ public abstract class LongVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, m, a, offset,
             (arr, off, v, vm)
-            -> v.stOp(arr, off, vm,
+            -> v.stOp(arr, (int) off, vm,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3525,71 +3538,33 @@ public abstract class LongVector extends AbstractVector {
     }
 
 
-    abstract
-    void intoByteArray0(byte[] a, int offset);
     @ForceInline
     final
-    void intoByteArray0Template(byte[] a, int offset) {
+    void intoMemorySegment0(MemorySegment ms, long offset) {
         LongSpecies vsp = vspecies();
-        VectorSupport.store(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, a, offset,
-            (arr, off, v) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off,
-                        (tb_, o, i, e) -> tb_.putLong(o + i * 8, e));
-            });
-    }
-
-    abstract
-    void intoByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    void intoByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        LongSpecies vsp = vspecies();
-        m.check(vsp);
-        VectorSupport.storeMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, m, a, offset,
-            (arr, off, v, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off, vm,
-                        (tb_, o, i, e) -> tb_.putLong(o + i * 8, e));
-            });
-    }
-
-    @ForceInline
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset) {
-        LongSpecies vsp = vspecies();
-        ScopedMemoryAccess.storeIntoByteBuffer(
+        ScopedMemoryAccess.storeIntoMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                this, bb, offset,
-                (buf, off, v) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off,
-                            (wb_, o, i, e) -> wb_.putLong(o + i * 8, e));
+                this,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v) -> {
+                    v.stLongOp((MemorySegment) msp, off, LongVector::memorySegmentSet);
                 });
     }
 
     abstract
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    void intoMemorySegment0(MemorySegment bb, long offset, VectorMask m);
     @ForceInline
     final
     >
-    void intoByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    void intoMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         LongSpecies vsp = vspecies();
         m.check(vsp);
-        ScopedMemoryAccess.storeIntoByteBufferMasked(
+        ScopedMemoryAccess.storeIntoMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                this, m, bb, offset,
-                (buf, off, v, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off, vm,
-                            (wb_, o, i, e) -> wb_.putLong(o + i * 8, e));
+                this, m,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v, vm) -> {
+                    v.stLongOp((MemorySegment) msp, off, vm, LongVector::memorySegmentSet);
                 });
     }
 
@@ -3606,6 +3581,16 @@ public abstract class LongVector extends AbstractVector {
             .checkIndexByLane(offset, limit, vsp.iota(), scale);
     }
 
+    private static
+    void checkMaskFromIndexSize(long offset,
+                                LongSpecies vsp,
+                                VectorMask m,
+                                int scale,
+                                long limit) {
+        ((AbstractMask)m)
+            .checkIndexByLane(offset, limit, vsp.iota(), scale);
+    }
+
     @ForceInline
     private void conditionalStoreNYI(int offset,
                                      LongSpecies vsp,
@@ -3907,6 +3892,21 @@ public abstract class LongVector extends AbstractVector {
             return dummyVector().ldOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        LongVector ldLongOp(MemorySegment memory, long offset,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        LongVector ldLongOp(MemorySegment memory, long offset,
+                                      VectorMask m,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, m, f);
+        }
+
         /*package-private*/
         @ForceInline
          void stOp(M memory, int offset, FStOp f) {
@@ -3921,6 +3921,20 @@ public abstract class LongVector extends AbstractVector {
             dummyVector().stOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset, FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset,
+                      AbstractMask m,
+                      FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, m, f);
+        }
+
         // N.B. Make sure these constant vectors and
         // masks load up correctly into registers.
         //
@@ -4034,3 +4048,4 @@ public abstract class LongVector extends AbstractVector {
     public static final VectorSpecies SPECIES_PREFERRED
         = (LongSpecies) VectorSpecies.ofPreferred(long.class);
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java
index ce7e3ca8c18..88639f96513 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class Short128Vector extends ShortVector {
                                     (Short128Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Short128Vector compress(VectorMask m) {
+        return (Short128Vector)
+            super.compressTemplate(Short128Mask.class,
+                                   (Short128Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Short128Vector expand(VectorMask m) {
+        return (Short128Vector)
+            super.expandTemplate(Short128Mask.class,
+                                   (Short128Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Short128Vector selectFrom(Vector v) {
@@ -661,6 +677,15 @@ final class Short128Vector extends ShortVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Short128Mask compress() {
+            return (Short128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Short128Vector.class, Short128Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -860,29 +885,15 @@ final class Short128Vector extends ShortVector {
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Short128Mask.class, a, offset, (Short128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Short128Mask.class, bb, offset, (Short128Mask) m);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Short128Mask.class, ms, offset, (Short128Mask) m);  // specialize
     }
 
     @ForceInline
@@ -904,22 +915,8 @@ final class Short128Vector extends ShortVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Short128Mask.class, a, offset, (Short128Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Short128Mask.class, bb, offset, (Short128Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Short128Mask.class, ms, offset, (Short128Mask) m);
     }
 
     @ForceInline
@@ -934,3 +931,4 @@ final class Short128Vector extends ShortVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java
index 3d7b00ddcd0..bf3802a869f 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class Short256Vector extends ShortVector {
                                     (Short256Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Short256Vector compress(VectorMask m) {
+        return (Short256Vector)
+            super.compressTemplate(Short256Mask.class,
+                                   (Short256Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Short256Vector expand(VectorMask m) {
+        return (Short256Vector)
+            super.expandTemplate(Short256Mask.class,
+                                   (Short256Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Short256Vector selectFrom(Vector v) {
@@ -677,6 +693,15 @@ final class Short256Vector extends ShortVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Short256Mask compress() {
+            return (Short256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Short256Vector.class, Short256Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -876,29 +901,15 @@ final class Short256Vector extends ShortVector {
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Short256Mask.class, a, offset, (Short256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Short256Mask.class, bb, offset, (Short256Mask) m);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Short256Mask.class, ms, offset, (Short256Mask) m);  // specialize
     }
 
     @ForceInline
@@ -920,22 +931,8 @@ final class Short256Vector extends ShortVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Short256Mask.class, a, offset, (Short256Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Short256Mask.class, bb, offset, (Short256Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Short256Mask.class, ms, offset, (Short256Mask) m);
     }
 
     @ForceInline
@@ -950,3 +947,4 @@ final class Short256Vector extends ShortVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java
index 2d23dcae93f..0a0727bdb52 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class Short512Vector extends ShortVector {
                                     (Short512Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Short512Vector compress(VectorMask m) {
+        return (Short512Vector)
+            super.compressTemplate(Short512Mask.class,
+                                   (Short512Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Short512Vector expand(VectorMask m) {
+        return (Short512Vector)
+            super.expandTemplate(Short512Mask.class,
+                                   (Short512Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Short512Vector selectFrom(Vector v) {
@@ -709,6 +725,15 @@ final class Short512Vector extends ShortVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Short512Mask compress() {
+            return (Short512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Short512Vector.class, Short512Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -908,29 +933,15 @@ final class Short512Vector extends ShortVector {
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Short512Mask.class, a, offset, (Short512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Short512Mask.class, bb, offset, (Short512Mask) m);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Short512Mask.class, ms, offset, (Short512Mask) m);  // specialize
     }
 
     @ForceInline
@@ -952,22 +963,8 @@ final class Short512Vector extends ShortVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Short512Mask.class, a, offset, (Short512Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Short512Mask.class, bb, offset, (Short512Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Short512Mask.class, ms, offset, (Short512Mask) m);
     }
 
     @ForceInline
@@ -982,3 +979,4 @@ final class Short512Vector extends ShortVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java
index f7e0c0162d3..ceff8f52341 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class Short64Vector extends ShortVector {
                                     (Short64Vector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public Short64Vector compress(VectorMask m) {
+        return (Short64Vector)
+            super.compressTemplate(Short64Mask.class,
+                                   (Short64Mask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public Short64Vector expand(VectorMask m) {
+        return (Short64Vector)
+            super.expandTemplate(Short64Mask.class,
+                                   (Short64Mask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public Short64Vector selectFrom(Vector v) {
@@ -653,6 +669,15 @@ final class Short64Vector extends ShortVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public Short64Mask compress() {
+            return (Short64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                Short64Vector.class, Short64Mask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -852,29 +877,15 @@ final class Short64Vector extends ShortVector {
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(Short64Mask.class, a, offset, (Short64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(Short64Mask.class, bb, offset, (Short64Mask) m);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(Short64Mask.class, ms, offset, (Short64Mask) m);  // specialize
     }
 
     @ForceInline
@@ -896,22 +907,8 @@ final class Short64Vector extends ShortVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(Short64Mask.class, a, offset, (Short64Mask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(Short64Mask.class, bb, offset, (Short64Mask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(Short64Mask.class, ms, offset, (Short64Mask) m);
     }
 
     @ForceInline
@@ -926,3 +923,4 @@ final class Short64Vector extends ShortVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java
index 154096d9d6f..142bcc1289e 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java
@@ -24,7 +24,7 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.IntUnaryOperator;
@@ -474,6 +474,22 @@ final class ShortMaxVector extends ShortVector {
                                     (ShortMaxVector) v);  // specialize
     }
 
+    @Override
+    @ForceInline
+    public ShortMaxVector compress(VectorMask m) {
+        return (ShortMaxVector)
+            super.compressTemplate(ShortMaxMask.class,
+                                   (ShortMaxMask) m);  // specialize
+    }
+
+    @Override
+    @ForceInline
+    public ShortMaxVector expand(VectorMask m) {
+        return (ShortMaxVector)
+            super.expandTemplate(ShortMaxMask.class,
+                                   (ShortMaxMask) m);  // specialize
+    }
+
     @Override
     @ForceInline
     public ShortMaxVector selectFrom(Vector v) {
@@ -647,6 +663,15 @@ final class ShortMaxVector extends ShortVector {
             return xor(maskAll(true));
         }
 
+        @Override
+        @ForceInline
+        public ShortMaxMask compress() {
+            return (ShortMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
+                ShortMaxVector.class, ShortMaxMask.class, ETYPE, VLENGTH, null, this,
+                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
+        }
+
+
         // Binary operations
 
         @Override
@@ -846,29 +871,15 @@ final class ShortMaxVector extends ShortVector {
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset) {
-        return super.fromByteArray0Template(a, offset);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset) {
+        return super.fromMemorySegment0Template(ms, offset);  // specialize
     }
 
     @ForceInline
     @Override
     final
-    ShortVector fromByteArray0(byte[] a, int offset, VectorMask m) {
-        return super.fromByteArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset) {
-        return super.fromByteBuffer0Template(bb, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        return super.fromByteBuffer0Template(ShortMaxMask.class, bb, offset, (ShortMaxMask) m);  // specialize
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        return super.fromMemorySegment0Template(ShortMaxMask.class, ms, offset, (ShortMaxMask) m);  // specialize
     }
 
     @ForceInline
@@ -890,22 +901,8 @@ final class ShortMaxVector extends ShortVector {
     @ForceInline
     @Override
     final
-    void intoByteArray0(byte[] a, int offset) {
-        super.intoByteArray0Template(a, offset);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteArray0(byte[] a, int offset, VectorMask m) {
-        super.intoByteArray0Template(ShortMaxMask.class, a, offset, (ShortMaxMask) m);  // specialize
-    }
-
-    @ForceInline
-    @Override
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m) {
-        super.intoByteBuffer0Template(ShortMaxMask.class, bb, offset, (ShortMaxMask) m);
+    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask m) {
+        super.intoMemorySegment0Template(ShortMaxMask.class, ms, offset, (ShortMaxMask) m);
     }
 
     @ForceInline
@@ -920,3 +917,4 @@ final class ShortMaxVector extends ShortVector {
     // ================================================
 
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java
index 7558fc6c56a..f5dec202003 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java
@@ -24,14 +24,14 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
+import java.lang.foreign.ValueLayout;
 import java.nio.ByteOrder;
-import java.nio.ReadOnlyBufferException;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.function.Function;
-import java.util.function.UnaryOperator;
 
+import jdk.internal.foreign.AbstractMemorySegmentImpl;
 import jdk.internal.misc.ScopedMemoryAccess;
 import jdk.internal.misc.Unsafe;
 import jdk.internal.vm.annotation.ForceInline;
@@ -57,6 +57,8 @@ public abstract class ShortVector extends AbstractVector {
 
     static final int FORBID_OPCODE_KIND = VO_ONLYFP;
 
+    static final ValueLayout.OfShort ELEMENT_LAYOUT = ValueLayout.JAVA_SHORT.withBitAlignment(8);
+
     @ForceInline
     static int opCode(Operator op) {
         return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND);
@@ -351,6 +353,45 @@ public abstract class ShortVector extends AbstractVector {
         return vectorFactory(res);
     }
 
+    /*package-private*/
+    interface FLdLongOp {
+        short apply(MemorySegment memory, long offset, int i);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    ShortVector ldLongOp(MemorySegment memory, long offset,
+                                  FLdLongOp f) {
+        //dummy; no vec = vec();
+        short[] res = new short[length()];
+        for (int i = 0; i < res.length; i++) {
+            res[i] = f.apply(memory, offset, i);
+        }
+        return vectorFactory(res);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    ShortVector ldLongOp(MemorySegment memory, long offset,
+                                  VectorMask m,
+                                  FLdLongOp f) {
+        //short[] vec = vec();
+        short[] res = new short[length()];
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < res.length; i++) {
+            if (mbits[i]) {
+                res[i] = f.apply(memory, offset, i);
+            }
+        }
+        return vectorFactory(res);
+    }
+
+    static short memorySegmentGet(MemorySegment ms, long o, int i) {
+        return ms.get(ELEMENT_LAYOUT, o + i * 2L);
+    }
+
     interface FStOp {
         void apply(M memory, int offset, int i, short a);
     }
@@ -381,6 +422,40 @@ public abstract class ShortVector extends AbstractVector {
         }
     }
 
+    interface FStLongOp {
+        void apply(MemorySegment memory, long offset, int i, short a);
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  FStLongOp f) {
+        short[] vec = vec();
+        for (int i = 0; i < vec.length; i++) {
+            f.apply(memory, offset, i, vec[i]);
+        }
+    }
+
+    /*package-private*/
+    @ForceInline
+    final
+    void stLongOp(MemorySegment memory, long offset,
+                  VectorMask m,
+                  FStLongOp f) {
+        short[] vec = vec();
+        boolean[] mbits = ((AbstractMask)m).getBits();
+        for (int i = 0; i < vec.length; i++) {
+            if (mbits[i]) {
+                f.apply(memory, offset, i, vec[i]);
+            }
+        }
+    }
+
+    static void memorySegmentSet(MemorySegment ms, long o, int i, short e) {
+        ms.set(ELEMENT_LAYOUT, o + i * 2L, e);
+    }
+
     // Binary test
 
     /*package-private*/
@@ -431,6 +506,36 @@ public abstract class ShortVector extends AbstractVector {
         return ((short)bits);
     }
 
+    static ShortVector expandHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        ShortVector r  = (ShortVector) vsp.zero();
+        ShortVector vi = (ShortVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(i, vi.lane(j++));
+            }
+        }
+        return r;
+    }
+
+    static ShortVector compressHelper(Vector v, VectorMask m) {
+        VectorSpecies vsp = m.vectorSpecies();
+        ShortVector r  = (ShortVector) vsp.zero();
+        ShortVector vi = (ShortVector) v;
+        if (m.allTrue()) {
+            return vi;
+        }
+        for (int i = 0, j = 0; i < vsp.length(); i++) {
+            if (m.laneIsSet(i)) {
+                r = r.withLane(j++, vi.lane(i));
+            }
+        }
+        return r;
+    }
+
     // Static factories (other than memory operations)
 
     // Note: A surprising behavior in javadoc
@@ -620,6 +725,16 @@ public abstract class ShortVector extends AbstractVector {
                     v0.uOp(m, (i, a) -> (short) -a);
             case VECTOR_OP_ABS: return (v0, m) ->
                     v0.uOp(m, (i, a) -> (short) Math.abs(a));
+            case VECTOR_OP_BIT_COUNT: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (short) bitCount(a));
+            case VECTOR_OP_TZ_COUNT: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (short) numberOfTrailingZeros(a));
+            case VECTOR_OP_LZ_COUNT: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (short) numberOfLeadingZeros(a));
+            case VECTOR_OP_REVERSE: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> reverse(a));
+            case VECTOR_OP_REVERSE_BYTES: return (v0, m) ->
+                    v0.uOp(m, (i, a) -> (short) Short.reverseBytes(a));
             default: return null;
         }
     }
@@ -1746,6 +1861,26 @@ public abstract class ShortVector extends AbstractVector {
         return lanewise(ABS);
     }
 
+    static int bitCount(short a) {
+        return Integer.bitCount((int)a & 0xFFFF);
+    }
+    static int numberOfTrailingZeros(short a) {
+        return a != 0 ? Integer.numberOfTrailingZeros(a) : 16;
+    }
+    static int numberOfLeadingZeros(short a) {
+        return a >= 0 ? Integer.numberOfLeadingZeros(a) - 16 : 0;
+    }
+
+    static short reverse(short a) {
+        if (a == 0 || a == -1) return a;
+
+        short b = rotateLeft(a, 8);
+        b = (short) (((b & 0x5555) << 1) | ((b & 0xAAAA) >>> 1));
+        b = (short) (((b & 0x3333) << 2) | ((b & 0xCCCC) >>> 2));
+        b = (short) (((b & 0x0F0F) << 4) | ((b & 0xF0F0) >>> 4));
+        return b;
+    }
+
     // not (~)
     /**
      * Computes the bitwise logical complement ({@code ~})
@@ -2372,6 +2507,45 @@ public abstract class ShortVector extends AbstractVector {
                                      ShortVector::toShuffle0);
     }
 
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    ShortVector compress(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    ShortVector compressTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (ShortVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype,
+                                                        short.class, length(), this, m,
+                                                        (v1, m1) -> compressHelper(v1, m1));
+    }
+
+    /**
+     * {@inheritDoc} 
+     * @since 19
+     */
+    @Override
+    public abstract
+    ShortVector expand(VectorMask m);
+
+    /*package-private*/
+    @ForceInline
+    final
+    >
+    ShortVector expandTemplate(Class masktype, M m) {
+      m.check(masktype, this);
+      return (ShortVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype,
+                                                        short.class, length(), this, m,
+                                                        (v1, m1) -> expandHelper(v1, m1));
+    }
+
+
     /**
      * {@inheritDoc} 
      */
@@ -2784,90 +2958,6 @@ public abstract class ShortVector extends AbstractVector {
         return res;
     }
 
-    /**
-     * Loads a vector from a byte array starting at an offset.
-     * Bytes are composed into primitive lane elements according
-     * to the specified byte order.
-     * The vector is arranged into lanes according to
-     * memory ordering.
-     * 

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - */ - @ForceInline - public static - ShortVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), a.length); - ShortSpecies vsp = (ShortSpecies) species; - return vsp.dummyVector().fromByteArray0(a, offset).maybeSwap(bo); - } - - /** - * Loads a vector from a byte array starting at an offset - * and using a mask. - * Lanes where the mask is unset are filled with the default - * value of {@code short} (zero). - * Bytes are composed into primitive lane elements according - * to the specified byte order. - * The vector is arranged into lanes according to - * memory ordering. - *

- * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

{@code
-     * var bb = ByteBuffer.wrap(a);
-     * return fromByteBuffer(species, bb, offset, bo, m);
-     * }
- * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @param m the mask controlling lane selection - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - * where the mask is set - */ - @ForceInline - public static - ShortVector fromByteArray(VectorSpecies species, - byte[] a, int offset, - ByteOrder bo, - VectorMask m) { - ShortSpecies vsp = (ShortSpecies) species; - if (offset >= 0 && offset <= (a.length - species.vectorByteSize())) { - return vsp.dummyVector().fromByteArray0(a, offset, m).maybeSwap(bo); - } - - // FIXME: optimize - checkMaskFromIndexSize(offset, vsp, m, 2, a.length); - ByteBuffer wb = wrapper(a, bo); - return vsp.ldOp(wb, offset, (AbstractMask)m, - (wb_, o, i) -> wb_.getShort(o + i * 2)); - } - /** * Loads a vector from an array of type {@code short[]} * starting at an offset. @@ -3167,44 +3257,49 @@ public abstract class ShortVector extends AbstractVector { /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer. + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment. * Bytes are composed into primitive lane elements according * to the specified byte order. * The vector is arranged into lanes according to * memory ordering. *

* This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: + * {@link #fromMemorySegment(VectorSpecies,MemorySegment,long,ByteOrder,VectorMask) + * fromMemorySegment()} as follows: *

{@code
      * var m = species.maskAll(true);
-     * return fromByteBuffer(species, bb, offset, bo, m);
+     * return fromMemorySegment(species, ms, offset, bo, m);
      * }
* * @param species species of desired vector - * @param bb the byte buffer - * @param offset the offset into the byte buffer + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order - * @return a vector loaded from a byte buffer + * @return a vector loaded from the memory segment * @throws IndexOutOfBoundsException * if {@code offset+N*2 < 0} - * or {@code offset+N*2 >= bb.limit()} + * or {@code offset+N*2 >= ms.byteSize()} * for any lane {@code N} in the vector + * @throws IllegalArgumentException if the memory segment is a heap segment that is + * not backed by a {@code byte[]} array. + * @throws IllegalStateException if the memory segment's session is not alive, + * or if access occurs from a thread other than the thread owning the session. + * @since 19 */ @ForceInline public static - ShortVector fromByteBuffer(VectorSpecies species, - ByteBuffer bb, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), bb.limit()); + ShortVector fromMemorySegment(VectorSpecies species, + MemorySegment ms, long offset, + ByteOrder bo) { + offset = checkFromIndexSize(offset, species.vectorByteSize(), ms.byteSize()); ShortSpecies vsp = (ShortSpecies) species; - return vsp.dummyVector().fromByteBuffer0(bb, offset).maybeSwap(bo); + return vsp.dummyVector().fromMemorySegment0(ms, offset).maybeSwap(bo); } /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment * and using a mask. * Lanes where the mask is unset are filled with the default * value of {@code short} (zero). @@ -3215,13 +3310,11 @@ public abstract class ShortVector extends AbstractVector { *

* The following pseudocode illustrates the behavior: *

{@code
-     * ShortBuffer eb = bb.duplicate()
-     *     .position(offset)
-     *     .order(bo).asShortBuffer();
+     * var slice = ms.asSlice(offset);
      * short[] ar = new short[species.length()];
      * for (int n = 0; n < ar.length; n++) {
      *     if (m.laneIsSet(n)) {
-     *         ar[n] = eb.get(n);
+     *         ar[n] = slice.getAtIndex(ValuaLayout.JAVA_SHORT.withBitAlignment(8), n);
      *     }
      * }
      * ShortVector r = ShortVector.fromArray(species, ar, 0);
@@ -3235,33 +3328,36 @@ public abstract class ShortVector extends AbstractVector {
      * the bytes of lane values.
      *
      * @param species species of desired vector
-     * @param bb the byte buffer
-     * @param offset the offset into the byte buffer
+     * @param ms the memory segment
+     * @param offset the offset into the memory segment
      * @param bo the intended byte order
      * @param m the mask controlling lane selection
-     * @return a vector loaded from a byte buffer
+     * @return a vector loaded from the memory segment
      * @throws IndexOutOfBoundsException
      *         if {@code offset+N*2 < 0}
-     *         or {@code offset+N*2 >= bb.limit()}
+     *         or {@code offset+N*2 >= ms.byteSize()}
      *         for any lane {@code N} in the vector
      *         where the mask is set
+     * @throws IllegalArgumentException if the memory segment is a heap segment that is
+     *         not backed by a {@code byte[]} array.
+     * @throws IllegalStateException if the memory segment's session is not alive,
+     *         or if access occurs from a thread other than the thread owning the session.
+     * @since 19
      */
     @ForceInline
     public static
-    ShortVector fromByteBuffer(VectorSpecies species,
-                                        ByteBuffer bb, int offset,
-                                        ByteOrder bo,
-                                        VectorMask m) {
+    ShortVector fromMemorySegment(VectorSpecies species,
+                                           MemorySegment ms, long offset,
+                                           ByteOrder bo,
+                                           VectorMask m) {
         ShortSpecies vsp = (ShortSpecies) species;
-        if (offset >= 0 && offset <= (bb.limit() - species.vectorByteSize())) {
-            return vsp.dummyVector().fromByteBuffer0(bb, offset, m).maybeSwap(bo);
+        if (offset >= 0 && offset <= (ms.byteSize() - species.vectorByteSize())) {
+            return vsp.dummyVector().fromMemorySegment0(ms, offset, m).maybeSwap(bo);
         }
 
         // FIXME: optimize
-        checkMaskFromIndexSize(offset, vsp, m, 2, bb.limit());
-        ByteBuffer wb = wrapper(bb, bo);
-        return vsp.ldOp(wb, offset, (AbstractMask)m,
-                   (wb_, o, i)  -> wb_.getShort(o + i * 2));
+        checkMaskFromIndexSize(offset, vsp, m, 2, ms.byteSize());
+        return vsp.ldLongOp(ms, offset, m, ShortVector::memorySegmentGet);
     }
 
     // Memory store operations
@@ -3291,7 +3387,7 @@ public abstract class ShortVector extends AbstractVector {
             this,
             a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
@@ -3437,7 +3533,7 @@ public abstract class ShortVector extends AbstractVector {
             this,
             a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_ + i] = (char) e));
     }
 
@@ -3567,67 +3663,40 @@ public abstract class ShortVector extends AbstractVector {
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo) {
-        offset = checkFromIndexSize(offset, byteSize(), a.length);
-        maybeSwap(bo).intoByteArray0(a, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteArray(byte[] a, int offset,
-                       ByteOrder bo,
-                       VectorMask m) {
-        if (m.allTrue()) {
-            intoByteArray(a, offset, bo);
-        } else {
-            ShortSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 2, a.length);
-            maybeSwap(bo).intoByteArray0(a, offset, m);
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo) {
+        if (ms.isReadOnly()) {
+            throw new UnsupportedOperationException("Attempt to write a read-only segment");
         }
+
+        offset = checkFromIndexSize(offset, byteSize(), ms.byteSize());
+        maybeSwap(bo).intoMemorySegment0(ms, offset);
     }
 
     /**
      * {@inheritDoc} 
+     * @since 19
      */
     @Override
     @ForceInline
     public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo) {
-        if (ScopedMemoryAccess.isReadOnly(bb)) {
-            throw new ReadOnlyBufferException();
-        }
-        offset = checkFromIndexSize(offset, byteSize(), bb.limit());
-        maybeSwap(bo).intoByteBuffer0(bb, offset);
-    }
-
-    /**
-     * {@inheritDoc} 
-     */
-    @Override
-    @ForceInline
-    public final
-    void intoByteBuffer(ByteBuffer bb, int offset,
-                        ByteOrder bo,
-                        VectorMask m) {
+    void intoMemorySegment(MemorySegment ms, long offset,
+                           ByteOrder bo,
+                           VectorMask m) {
         if (m.allTrue()) {
-            intoByteBuffer(bb, offset, bo);
+            intoMemorySegment(ms, offset, bo);
         } else {
-            if (bb.isReadOnly()) {
-                throw new ReadOnlyBufferException();
+            if (ms.isReadOnly()) {
+                throw new UnsupportedOperationException("Attempt to write a read-only segment");
             }
             ShortSpecies vsp = vspecies();
-            checkMaskFromIndexSize(offset, vsp, m, 2, bb.limit());
-            maybeSwap(bo).intoByteBuffer0(bb, offset, m);
+            checkMaskFromIndexSize(offset, vsp, m, 2, ms.byteSize());
+            maybeSwap(bo).intoMemorySegment0(ms, offset, m);
         }
     }
 
@@ -3661,7 +3730,7 @@ public abstract class ShortVector extends AbstractVector {
             vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset),
             a, offset, vsp,
-            (arr, off, s) -> s.ldOp(arr, off,
+            (arr, off, s) -> s.ldOp(arr, (int) off,
                                     (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3678,7 +3747,7 @@ public abstract class ShortVector extends AbstractVector {
             vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
             a, arrayAddress(a, offset), m,
             a, offset, vsp,
-            (arr, off, s, vm) -> s.ldOp(arr, off, vm,
+            (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                         (arr_, off_, i) -> arr_[off_ + i]));
     }
 
@@ -3694,7 +3763,7 @@ public abstract class ShortVector extends AbstractVector {
             vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
             a, charArrayAddress(a, offset),
             a, offset, vsp,
-            (arr, off, s) -> s.ldOp(arr, off,
+            (arr, off, s) -> s.ldOp(arr, (int) off,
                                     (arr_, off_, i) -> (short) arr_[off_ + i]));
     }
 
@@ -3711,79 +3780,38 @@ public abstract class ShortVector extends AbstractVector {
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
                 a, charArrayAddress(a, offset), m,
                 a, offset, vsp,
-                (arr, off, s, vm) -> s.ldOp(arr, off, vm,
+                (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                             (arr_, off_, i) -> (short) arr_[off_ + i]));
     }
 
 
-    @Override
     abstract
-    ShortVector fromByteArray0(byte[] a, int offset);
+    ShortVector fromMemorySegment0(MemorySegment bb, long offset);
     @ForceInline
     final
-    ShortVector fromByteArray0Template(byte[] a, int offset) {
+    ShortVector fromMemorySegment0Template(MemorySegment ms, long offset) {
         ShortSpecies vsp = vspecies();
-        return VectorSupport.load(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            a, offset, vsp,
-            (arr, off, s) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off,
-                        (wb_, o, i) -> wb_.getShort(o + i * 2));
-            });
-    }
-
-    abstract
-    ShortVector fromByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    ShortVector fromByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        ShortSpecies vsp = vspecies();
-        m.check(vsp);
-        return VectorSupport.loadMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset), m,
-            a, offset, vsp,
-            (arr, off, s, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                return s.ldOp(wb, off, vm,
-                        (wb_, o, i) -> wb_.getShort(o + i * 2));
-            });
-    }
-
-    abstract
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset);
-    @ForceInline
-    final
-    ShortVector fromByteBuffer0Template(ByteBuffer bb, int offset) {
-        ShortSpecies vsp = vspecies();
-        return ScopedMemoryAccess.loadFromByteBuffer(
+        return ScopedMemoryAccess.loadFromMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                bb, offset, vsp,
-                (buf, off, s) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off,
-                            (wb_, o, i) -> wb_.getShort(o + i * 2));
+                (AbstractMemorySegmentImpl) ms, offset, vsp,
+                (msp, off, s) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, ShortVector::memorySegmentGet);
                 });
     }
 
     abstract
-    ShortVector fromByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    ShortVector fromMemorySegment0(MemorySegment ms, long offset, VectorMask m);
     @ForceInline
     final
     >
-    ShortVector fromByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    ShortVector fromMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         ShortSpecies vsp = vspecies();
         m.check(vsp);
-        return ScopedMemoryAccess.loadFromByteBufferMasked(
+        return ScopedMemoryAccess.loadFromMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                bb, offset, m, vsp,
-                (buf, off, s, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    return s.ldOp(wb, off, vm,
-                            (wb_, o, i) -> wb_.getShort(o + i * 2));
+                (AbstractMemorySegmentImpl) ms, offset, m, vsp,
+                (msp, off, s, vm) -> {
+                    return s.ldLongOp((MemorySegment) msp, off, vm, ShortVector::memorySegmentGet);
                 });
     }
 
@@ -3802,7 +3830,7 @@ public abstract class ShortVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, a, offset,
             (arr, off, v)
-            -> v.stOp(arr, off,
+            -> v.stOp(arr, (int) off,
                       (arr_, off_, i, e) -> arr_[off_+i] = e));
     }
 
@@ -3819,77 +3847,39 @@ public abstract class ShortVector extends AbstractVector {
             a, arrayAddress(a, offset),
             this, m, a, offset,
             (arr, off, v, vm)
-            -> v.stOp(arr, off, vm,
+            -> v.stOp(arr, (int) off, vm,
                       (arr_, off_, i, e) -> arr_[off_ + i] = e));
     }
 
 
 
-    abstract
-    void intoByteArray0(byte[] a, int offset);
     @ForceInline
     final
-    void intoByteArray0Template(byte[] a, int offset) {
+    void intoMemorySegment0(MemorySegment ms, long offset) {
         ShortSpecies vsp = vspecies();
-        VectorSupport.store(
-            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, a, offset,
-            (arr, off, v) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off,
-                        (tb_, o, i, e) -> tb_.putShort(o + i * 2, e));
-            });
-    }
-
-    abstract
-    void intoByteArray0(byte[] a, int offset, VectorMask m);
-    @ForceInline
-    final
-    >
-    void intoByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
-        ShortSpecies vsp = vspecies();
-        m.check(vsp);
-        VectorSupport.storeMasked(
-            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-            a, byteArrayAddress(a, offset),
-            this, m, a, offset,
-            (arr, off, v, vm) -> {
-                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
-                v.stOp(wb, off, vm,
-                        (tb_, o, i, e) -> tb_.putShort(o + i * 2, e));
-            });
-    }
-
-    @ForceInline
-    final
-    void intoByteBuffer0(ByteBuffer bb, int offset) {
-        ShortSpecies vsp = vspecies();
-        ScopedMemoryAccess.storeIntoByteBuffer(
+        ScopedMemoryAccess.storeIntoMemorySegment(
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
-                this, bb, offset,
-                (buf, off, v) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off,
-                            (wb_, o, i, e) -> wb_.putShort(o + i * 2, e));
+                this,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v) -> {
+                    v.stLongOp((MemorySegment) msp, off, ShortVector::memorySegmentSet);
                 });
     }
 
     abstract
-    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask m);
+    void intoMemorySegment0(MemorySegment bb, long offset, VectorMask m);
     @ForceInline
     final
     >
-    void intoByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
+    void intoMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
         ShortSpecies vsp = vspecies();
         m.check(vsp);
-        ScopedMemoryAccess.storeIntoByteBufferMasked(
+        ScopedMemoryAccess.storeIntoMemorySegmentMasked(
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
-                this, m, bb, offset,
-                (buf, off, v, vm) -> {
-                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
-                    v.stOp(wb, off, vm,
-                            (wb_, o, i, e) -> wb_.putShort(o + i * 2, e));
+                this, m,
+                (AbstractMemorySegmentImpl) ms, offset,
+                (msp, off, v, vm) -> {
+                    v.stLongOp((MemorySegment) msp, off, vm, ShortVector::memorySegmentSet);
                 });
     }
 
@@ -3907,7 +3897,7 @@ public abstract class ShortVector extends AbstractVector {
             a, charArrayAddress(a, offset),
             this, m, a, offset,
             (arr, off, v, vm)
-            -> v.stOp(arr, off, vm,
+            -> v.stOp(arr, (int) off, vm,
                       (arr_, off_, i, e) -> arr_[off_ + i] = (char) e));
     }
 
@@ -3923,6 +3913,16 @@ public abstract class ShortVector extends AbstractVector {
             .checkIndexByLane(offset, limit, vsp.iota(), scale);
     }
 
+    private static
+    void checkMaskFromIndexSize(long offset,
+                                ShortSpecies vsp,
+                                VectorMask m,
+                                int scale,
+                                long limit) {
+        ((AbstractMask)m)
+            .checkIndexByLane(offset, limit, vsp.iota(), scale);
+    }
+
     @ForceInline
     private void conditionalStoreNYI(int offset,
                                      ShortSpecies vsp,
@@ -4250,6 +4250,21 @@ public abstract class ShortVector extends AbstractVector {
             return dummyVector().ldOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        ShortVector ldLongOp(MemorySegment memory, long offset,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        ShortVector ldLongOp(MemorySegment memory, long offset,
+                                      VectorMask m,
+                                      FLdLongOp f) {
+            return dummyVector().ldLongOp(memory, offset, m, f);
+        }
+
         /*package-private*/
         @ForceInline
          void stOp(M memory, int offset, FStOp f) {
@@ -4264,6 +4279,20 @@ public abstract class ShortVector extends AbstractVector {
             dummyVector().stOp(memory, offset, m, f);
         }
 
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset, FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, f);
+        }
+
+        /*package-private*/
+        @ForceInline
+        void stLongOp(MemorySegment memory, long offset,
+                      AbstractMask m,
+                      FStLongOp f) {
+            dummyVector().stLongOp(memory, offset, m, f);
+        }
+
         // N.B. Make sure these constant vectors and
         // masks load up correctly into registers.
         //
@@ -4377,3 +4406,4 @@ public abstract class ShortVector extends AbstractVector {
     public static final VectorSpecies SPECIES_PREFERRED
         = (ShortSpecies) VectorSpecies.ofPreferred(short.class);
 }
+
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java
index 09883ac3c1e..d34ac79e7c3 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java
@@ -24,7 +24,8 @@
  */
 package jdk.incubator.vector;
 
-import java.nio.ByteBuffer;
+import java.lang.foreign.MemorySegment;
+
 import java.nio.ByteOrder;
 import java.util.Arrays;
 
@@ -763,11 +764,11 @@ import java.util.Arrays;
  * first vector lane value occupies the first position in memory, and so on,
  * up to the length of the vector. Further, the memory order of stored
  * vector lanes corresponds to increasing index values in a Java array or
- * in a {@link java.nio.ByteBuffer}.
+ * in a {@link java.lang.foreign.MemorySegment}.
  *
  * 

Byte order for lane storage is chosen such that the stored * vector values can be read or written as single primitive values, - * within the array or buffer that holds the vector, producing the + * within the array or segment that holds the vector, producing the * same values as the lane-wise values within the vector. * This fact is independent of the convenient fiction that lane values * inside of vectors are stored in little-endian order. @@ -1039,6 +1040,12 @@ import java.util.Arrays; * can encode a mathematical permutation as well as many other * patterns of data movement. * + *

  • The {@link #compress(VectorMask)} and {@link #expand(VectorMask)} + * methods, which select up to {@code VLENGTH} lanes from an + * input vector, and assemble them in lane order. The selection of lanes + * is controlled by a {@code VectorMask}, with set lane elements mapping, by + * compression or expansion in lane order, source lanes to destination lanes. + * * *

    Some vector operations are not lane-wise, but rather move data * across lane boundaries. Such operations are typically rare in SIMD @@ -2689,6 +2696,46 @@ public abstract class Vector extends jdk.internal.vm.vector.VectorSupport.Vec */ public abstract Vector rearrange(VectorShuffle s, Vector v); + /** + * Compresses the lane elements of this vector selecting lanes + * under the control of a specific mask. + * + * This is a cross-lane operation that compresses the lane + * elements of this vector as selected by the specified mask. + * + * For each lane {@code N} of the mask, if the mask at + * lane {@code N} is set, the element at lane {@code N} + * of input vector is selected and stored into the output + * vector contiguously starting from the lane {@code 0}. + * All the upper remaining lanes, if any, of the output + * vector are set to zero. + * + * @param m the mask controlling the compression + * @return the compressed lane elements of this vector + * @since 19 + */ + public abstract Vector compress(VectorMask m); + + /** + * Expands the lane elements of this vector + * under the control of a specific mask. + * + * This is a cross-lane operation that expands the contiguous lane + * elements of this vector into lanes of an output vector + * as selected by the specified mask. + * + * For each lane {@code N} of the mask, if the mask at + * lane {@code N} is set, the next contiguous element of input vector + * starting from lane {@code 0} is selected and stored into the output + * vector at lane {@code N}. + * All the remaining lanes, if any, of the output vector are set to zero. + * + * @param m the mask controlling the compression + * @return the expanded lane elements of this vector + * @since 19 + */ + public abstract Vector expand(VectorMask m); + /** * Using index values stored in the lanes of this vector, * assemble values stored in second vector {@code v}. @@ -2854,9 +2901,8 @@ public abstract class Vector extends jdk.internal.vm.vector.VectorSupport.Vec * implementation costs. * *

    The method behaves as if this vector is stored into a byte - * buffer or array using little-endian byte ordering and then the - * desired vector is loaded from the same byte buffer or array - * using the same ordering. + * array using little-endian byte ordering and then the desired vector is loaded from the same byte + * array using the same ordering. * *

    The following pseudocode illustrates the behavior: *

    {@code
    @@ -2865,15 +2911,15 @@ public abstract class Vector extends jdk.internal.vm.vector.VectorSupport.Vec
          * int M = (domSize > ranSize ? domSize / ranSize : ranSize / domSize);
          * assert Math.abs(part) < M;
          * assert (part == 0) || (part > 0) == (domSize > ranSize);
    -     * byte[] ra = new byte[Math.max(domSize, ranSize)];
    +     * MemorySegment ms = MemorySegment.ofArray(new byte[Math.max(domSize, ranSize)]);
          * if (domSize > ranSize) {  // expansion
    -     *     this.intoByteArray(ra, 0, ByteOrder.native());
    +     *     this.intoMemorySegment(ms, 0, ByteOrder.native());
          *     int origin = part * ranSize;
    -     *     return species.fromByteArray(ra, origin, ByteOrder.native());
    +     *     return species.fromMemorySegment(ms, origin, ByteOrder.native());
          * } else {  // contraction or size-invariant
          *     int origin = (-part) * domSize;
    -     *     this.intoByteArray(ra, origin, ByteOrder.native());
    -     *     return species.fromByteArray(ra, 0, ByteOrder.native());
    +     *     this.intoMemorySegment(ms, origin, ByteOrder.native());
    +     *     return species.fromMemorySegment(ms, 0, ByteOrder.native());
          * }
          * }
    * @@ -2910,8 +2956,8 @@ public abstract class Vector extends jdk.internal.vm.vector.VectorSupport.Vec * * @return a {@code ByteVector} with the same shape and information content * @see Vector#reinterpretShape(VectorSpecies,int) - * @see IntVector#intoByteArray(byte[], int, ByteOrder) - * @see FloatVector#intoByteArray(byte[], int, ByteOrder) + * @see IntVector#intoMemorySegment(java.lang.foreign.MemorySegment, long, java.nio.ByteOrder) + * @see FloatVector#intoMemorySegment(java.lang.foreign.MemorySegment, long, java.nio.ByteOrder) * @see VectorSpecies#withLanes(Class) */ public abstract ByteVector reinterpretAsBytes(); @@ -3319,8 +3365,8 @@ public abstract class Vector extends jdk.internal.vm.vector.VectorSupport.Vec //Array stores /** - * Stores this vector into a byte array starting at an offset - * using explicit byte order. + * Stores this vector into a {@linkplain MemorySegment memory segment} + * starting at an offset using explicit byte order. *

    * Bytes are extracted from primitive lane elements according * to the specified byte ordering. @@ -3328,88 +3374,33 @@ public abstract class Vector extends jdk.internal.vm.vector.VectorSupport.Vec * memory ordering. *

    * This method behaves as if it calls - * {@link #intoByteBuffer(ByteBuffer,int,ByteOrder,VectorMask) - * intoByteBuffer()} as follows: - *

    {@code
    -     * var bb = ByteBuffer.wrap(a);
    -     * var m = maskAll(true);
    -     * intoByteBuffer(bb, offset, bo, m);
    -     * }
    - * - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - */ - public abstract void intoByteArray(byte[] a, int offset, - ByteOrder bo); - - /** - * Stores this vector into a byte array starting at an offset - * using explicit byte order and a mask. - *

    - * Bytes are extracted from primitive lane elements according - * to the specified byte ordering. - * The lanes are stored according to their - * memory ordering. - *

    - * This method behaves as if it calls - * {@link #intoByteBuffer(ByteBuffer,int,ByteOrder,VectorMask) - * intoByteBuffer()} as follows: - *

    {@code
    -     * var bb = ByteBuffer.wrap(a);
    -     * intoByteBuffer(bb, offset, bo, m);
    -     * }
    - * - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @param m the mask controlling lane selection - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - * where the mask is set - */ - public abstract void intoByteArray(byte[] a, int offset, - ByteOrder bo, - VectorMask m); - - /** - * Stores this vector into a byte buffer starting at an offset - * using explicit byte order. - *

    - * Bytes are extracted from primitive lane elements according - * to the specified byte ordering. - * The lanes are stored according to their - * memory ordering. - *

    - * This method behaves as if it calls - * {@link #intoByteBuffer(ByteBuffer,int,ByteOrder,VectorMask) - * intoByteBuffer()} as follows: + * {@link #intoMemorySegment(MemorySegment,long,ByteOrder,VectorMask) + * intoMemorySegment()} as follows: *

    {@code
          * var m = maskAll(true);
    -     * intoByteBuffer(bb, offset, bo, m);
    +     * intoMemorySegment(ms, offset, bo, m);
          * }
    * - * @param bb the byte buffer - * @param offset the offset into the array + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order * @throws IndexOutOfBoundsException * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > bb.limit()} + * or {@code offset+(N+1)*ESIZE > ms.byteSize()} * for any lane {@code N} in the vector - * @throws java.nio.ReadOnlyBufferException - * if the byte buffer is read-only + * @throws UnsupportedOperationException + * if the memory segment is read-only + * @throws IllegalArgumentException if the memory segment is a heap segment that is + * not backed by a {@code byte[]} array. + * @throws IllegalStateException if the memory segment's session is not alive, + * or if access occurs from a thread other than the thread owning the session. + * @since 19 */ - public abstract void intoByteBuffer(ByteBuffer bb, int offset, ByteOrder bo); + public abstract void intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo); /** - * Stores this vector into a byte buffer starting at an offset - * using explicit byte order and a mask. + * Stores this vector into a {@linkplain MemorySegment memory segment} + * starting at an offset using explicit byte order and a mask. *

    * Bytes are extracted from primitive lane elements according * to the specified byte ordering. @@ -3417,28 +3408,18 @@ public abstract class Vector extends jdk.internal.vm.vector.VectorSupport.Vec * memory ordering. *

    * The following pseudocode illustrates the behavior, where - * the primitive element type is not of {@code byte}, - * {@code EBuffer} is the primitive buffer type, {@code ETYPE} is the + * {@code JAVA_E} is the layout of the primitive element type, {@code ETYPE} is the * primitive element type, and {@code EVector} is the primitive * vector type for this vector: *

    {@code
    -     * EBuffer eb = bb.duplicate()
    -     *     .position(offset)
    -     *     .order(bo).asEBuffer();
          * ETYPE[] a = this.toArray();
    +     * var slice = ms.asSlice(offset)
          * for (int n = 0; n < a.length; n++) {
          *     if (m.laneIsSet(n)) {
    -     *         eb.put(n, a[n]);
    +     *         slice.setAtIndex(ValueLayout.JAVA_E.withBitAlignment(8), n);
          *     }
          * }
          * }
    - * When the primitive element type is of {@code byte} the primitive - * byte buffer is obtained as follows, where operation on the buffer - * remains the same as in the prior pseudocode: - *
    {@code
    -     * ByteBuffer eb = bb.duplicate()
    -     *     .position(offset);
    -     * }
    * * @implNote * This operation is likely to be more efficient if @@ -3451,20 +3432,25 @@ public abstract class Vector extends jdk.internal.vm.vector.VectorSupport.Vec * {@code byte}, the byte order argument is * ignored. * - * @param bb the byte buffer - * @param offset the offset into the array + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order * @param m the mask controlling lane selection * @throws IndexOutOfBoundsException * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > bb.limit()} + * or {@code offset+(N+1)*ESIZE > ms.byteSize()} * for any lane {@code N} in the vector * where the mask is set - * @throws java.nio.ReadOnlyBufferException - * if the byte buffer is read-only + * @throws UnsupportedOperationException + * if the memory segment is read-only + * @throws IllegalArgumentException if the memory segment is a heap segment that is + * not backed by a {@code byte[]} array. + * @throws IllegalStateException if the memory segment's session is not alive, + * or if access occurs from a thread other than the thread owning the session. + * @since 19 */ - public abstract void intoByteBuffer(ByteBuffer bb, int offset, - ByteOrder bo, VectorMask m); + public abstract void intoMemorySegment(MemorySegment ms, long offset, + ByteOrder bo, VectorMask m); /** * Returns a packed array containing all the lane values. diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorIntrinsics.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorIntrinsics.java index bada3487379..8a469fdc79c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorIntrinsics.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorIntrinsics.java @@ -54,6 +54,16 @@ import java.util.Objects; } } + @ForceInline + static long checkFromIndexSize(long ix, long vlen, long length) { + switch (VectorIntrinsics.VECTOR_ACCESS_OOB_CHECK) { + case 0: return ix; // no range check + case 1: return Objects.checkFromIndexSize(ix, vlen, length); + case 2: return Objects.checkIndex(ix, length - (vlen - 1)); + default: throw new InternalError(); + } + } + @ForceInline static IntVector checkIndex(IntVector vix, int length) { switch (VectorIntrinsics.VECTOR_ACCESS_OOB_CHECK) { @@ -92,9 +102,30 @@ import java.util.Objects; if (index >= 0) { return index - (index % size); } else { - return index - Math.floorMod(index, Math.abs(size)); + return index - Math.floorMod(index, size); } } + + // If the index is not already a multiple of size, + // round it down to the next smaller multiple of size. + // It is an error if size is less than zero. + @ForceInline + static long roundDown(long index, int size) { + if ((size & (size - 1)) == 0) { + // Size is zero or a power of two, so we got this. + return index & ~(size - 1); + } else { + return roundDownNPOT(index, size); + } + } + private static long roundDownNPOT(long index, int size) { + if (index >= 0) { + return index - (index % size); + } else { + return index - Math.floorMod(index, size); + } + } + @ForceInline static int wrapToRange(int index, int size) { if ((size & (size - 1)) == 0) { diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java index 68dbf9915b7..14f0594121b 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java @@ -210,7 +210,7 @@ public abstract class VectorMask extends jdk.internal.vm.vector.VectorSupport bits, (long) offset + Unsafe.ARRAY_BOOLEAN_BASE_OFFSET, bits, offset, vsp, (c, idx, s) - -> s.opm(n -> c[idx + n])); + -> s.opm(n -> c[((int )idx) + n])); } /** @@ -471,6 +471,39 @@ public abstract class VectorMask extends jdk.internal.vm.vector.VectorSupport */ public abstract VectorMask indexInRange(int offset, int limit); + /** + * Removes lanes numbered {@code N} from this mask where the + * adjusted index {@code N+offset}, is not in the range + * {@code [0..limit-1]}. + * + *

    In all cases the series of set and unset lanes is assigned + * as if by using infinite precision or {@code VLENGTH-}saturating + * additions or subtractions, without overflow or wrap-around. + * + * @apiNote + * + * This method performs a SIMD emulation of the check performed by + * {@link Objects#checkIndex(long,long)}, on the index numbers in + * the range {@code [offset..offset+VLENGTH-1]}. If an exception + * is desired, the resulting mask can be compared with the + * original mask; if they are not equal, then at least one lane + * was out of range, and exception processing can be performed. + * + *

    A mask which is a series of {@code N} set lanes followed by + * a series of unset lanes can be obtained by calling + * {@code allTrue.indexInRange(0, N)}, where {@code allTrue} is a + * mask of all true bits. A mask of {@code N1} unset lanes + * followed by {@code N2} set lanes can be obtained by calling + * {@code allTrue.indexInRange(-N1, N2)}. + * + * @param offset the starting index + * @param limit the upper-bound (exclusive) of index range + * @return the original mask, with out-of-range lanes unset + * @see VectorSpecies#indexInRange(long, long) + * @since 19 + */ + public abstract VectorMask indexInRange(long offset, long limit); + /** * Returns a vector representation of this mask, the * lane bits of which are set or unset in correspondence @@ -621,6 +654,18 @@ public abstract class VectorMask extends jdk.internal.vm.vector.VectorSupport return Objects.hash(vectorSpecies(), Arrays.hashCode(toArray())); } + /** + * Compresses set lanes from this mask. + * + * Returns a mask which is a series of {@code N} set lanes + * followed by a series of unset lanes, where {@code N} is + * the true count of this mask. + * + * @return the compressed mask of this mask + * @since 19 + */ + public abstract VectorMask compress(); + // ==== JROSE NAME CHANGES ==== // TYPE CHANGED diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorOperators.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorOperators.java index e303fa984d1..ece08e22872 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorOperators.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorOperators.java @@ -452,6 +452,26 @@ public abstract class VectorOperators { public static final Unary ABS = unary("ABS", "abs", VectorSupport.VECTOR_OP_ABS, VO_ALL); /** Produce {@code -a}. */ public static final Unary NEG = unary("NEG", "-a", VectorSupport.VECTOR_OP_NEG, VO_ALL|VO_SPECIAL); + /** Produce {@code bitCount(a)} + * @since 19 + */ + public static final Unary BIT_COUNT = unary("BIT_COUNT", "bitCount", VectorSupport.VECTOR_OP_BIT_COUNT, VO_NOFP); + /** Produce {@code numberOfTrailingZeros(a)} + * @since 19 + */ + public static final Unary TRAILING_ZEROS_COUNT = unary("TRAILING_ZEROS_COUNT", "numberOfTrailingZeros", VectorSupport.VECTOR_OP_TZ_COUNT, VO_NOFP); + /** Produce {@code numberOfLeadingZeros(a)} + * @since 19 + */ + public static final Unary LEADING_ZEROS_COUNT = unary("LEADING_ZEROS_COUNT", "numberOfLeadingZeros", VectorSupport.VECTOR_OP_LZ_COUNT, VO_NOFP); + /** Produce {@code reverse(a)} + * @since 19 + */ + public static final Unary REVERSE = unary("REVERSE", "reverse", VectorSupport.VECTOR_OP_REVERSE, VO_NOFP); + /** Produce {@code reverseBytes(a)} + * @since 19 + */ + public static final Unary REVERSE_BYTES = unary("REVERSE_BYTES", "reverseBytes", VectorSupport.VECTOR_OP_REVERSE_BYTES, VO_NOFP); /** Produce {@code sin(a)}. Floating only. * Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above @@ -556,6 +576,14 @@ public abstract class VectorOperators { public static final /*bitwise*/ Binary ROL = binary("ROL", "rotateLeft", VectorSupport.VECTOR_OP_LROTATE, VO_SHIFT); /** Produce {@code rotateRight(a,n)}. Integral only. */ public static final /*bitwise*/ Binary ROR = binary("ROR", "rotateRight", VectorSupport.VECTOR_OP_RROTATE, VO_SHIFT); + /** Produce {@code compress(a,n)}. Integral, {@code int} and {@code long}, only. + * @since 19 + */ + public static final /*bitwise*/ Binary COMPRESS_BITS = binary("COMPRESS_BITS", "compressBits", VectorSupport.VECTOR_OP_COMPRESS_BITS, VO_NOFP); + /** Produce {@code expand(a,n)}. Integral, {@code int} and {@code long}, only. + * @since 19 + */ + public static final /*bitwise*/ Binary EXPAND_BITS = binary("EXPAND_BITS", "expandBits", VectorSupport.VECTOR_OP_EXPAND_BITS, VO_NOFP); /** Produce {@code atan2(a,b)}. See Floating only. * Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java index 604df465913..6cfe5f6d9d9 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java @@ -24,6 +24,8 @@ */ package jdk.incubator.vector; +import java.lang.foreign.MemorySegment; + import java.nio.ByteOrder; import java.util.function.IntUnaryOperator; @@ -149,11 +151,37 @@ public interface VectorSpecies { * @return the largest multiple of the vector length not greater * than the given length * @throws IllegalArgumentException if the {@code length} is - negative and the result would overflow to a positive value + * negative and the result would overflow to a positive value * @see Math#floorMod(int, int) */ int loopBound(int length); + /** + * Loop control function which returns the largest multiple of + * {@code VLENGTH} that is less than or equal to the given + * {@code length} value. + * Here, {@code VLENGTH} is the result of {@code this.length()}, + * and {@code length} is interpreted as a number of lanes. + * The resulting value {@code R} satisfies this inequality: + *

    {@code R <= length < R+VLENGTH}
    +     * 
    + *

    Specifically, this method computes + * {@code length - floorMod(length, VLENGTH)}, where + * {@link Math#floorMod(long,int) floorMod} computes a remainder + * value by rounding its quotient toward negative infinity. + * As long as {@code VLENGTH} is a power of two, then the result + * is also equal to {@code length & ~(VLENGTH - 1)}. + * + * @param length the input length + * @return the largest multiple of the vector length not greater + * than the given length + * @throws IllegalArgumentException if the {@code length} is + * negative and the result would overflow to a positive value + * @see Math#floorMod(long, int) + * @since 19 + */ + long loopBound(long length); + /** * Returns a mask of this species where only * the lanes at index N such that the adjusted index @@ -171,6 +199,24 @@ public interface VectorSpecies { */ VectorMask indexInRange(int offset, int limit); + /** + * Returns a mask of this species where only + * the lanes at index N such that the adjusted index + * {@code N+offset} is in the range {@code [0..limit-1]} + * are set. + * + *

    + * This method returns the value of the expression + * {@code maskAll(true).indexInRange(offset, limit)} + * + * @param offset the starting index + * @param limit the upper-bound (exclusive) of index range + * @return a mask with out-of-range lanes unset + * @see VectorMask#indexInRange(long, long) + * @since 19 + */ + VectorMask indexInRange(long offset, long limit); + /** * Checks that this species has the given element type, * and returns this species unchanged. @@ -433,31 +479,31 @@ public interface VectorSpecies { // Defined when ETYPE is known. /** - * Loads a vector of this species from a byte array starting - * at an offset. + * Loads a vector of this species from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment. * Bytes are composed into primitive lane elements according * to the specified byte order. * The vector is arranged into lanes according to * memory ordering. *

    * Equivalent to - * {@code IntVector.fromByteArray(this,a,offset,bo)} - * or an equivalent {@code fromByteArray} method, + * {@code IntVector.fromMemorySegment(this,ms,offset,bo)}, * on the vector type corresponding to * this species. * - * @param a a byte array - * @param offset the index of the first byte to load + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order - * @return a vector of the given species filled from the byte array + * @return a vector of the given species filled from the memory segment * @throws IndexOutOfBoundsException * if {@code offset+N*ESIZE < 0} * or {@code offset+(N+1)*ESIZE > a.length} * for any lane {@code N} in the vector - * @see IntVector#fromByteArray(VectorSpecies,byte[],int,ByteOrder) - * @see FloatVector#fromByteArray(VectorSpecies,byte[],int,ByteOrder) + * @see IntVector#fromMemorySegment(VectorSpecies, java.lang.foreign.MemorySegment, long, java.nio.ByteOrder) + * @see FloatVector#fromMemorySegment(VectorSpecies, java.lang.foreign.MemorySegment, long, java.nio.ByteOrder) + * @since 19 */ - Vector fromByteArray(byte[] a, int offset, ByteOrder bo); + Vector fromMemorySegment(MemorySegment ms, long offset, ByteOrder bo); /** * Returns a mask of this species diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template index 464cb2853df..ae53ec534d3 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template @@ -24,14 +24,14 @@ */ package jdk.incubator.vector; -import java.nio.ByteBuffer; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; import java.nio.ByteOrder; -import java.nio.ReadOnlyBufferException; import java.util.Arrays; import java.util.Objects; import java.util.function.Function; -import java.util.function.UnaryOperator; +import jdk.internal.foreign.AbstractMemorySegmentImpl; import jdk.internal.misc.ScopedMemoryAccess; import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.ForceInline; @@ -61,6 +61,8 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { static final int FORBID_OPCODE_KIND = VO_ONLYFP; #end[FP] + static final ValueLayout.Of$Type$ ELEMENT_LAYOUT = ValueLayout.JAVA_$TYPE$.withBitAlignment(8); + @ForceInline static int opCode(Operator op) { return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND); @@ -355,6 +357,45 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { return vectorFactory(res); } + /*package-private*/ + interface FLdLongOp { + $type$ apply(MemorySegment memory, long offset, int i); + } + + /*package-private*/ + @ForceInline + final + $abstractvectortype$ ldLongOp(MemorySegment memory, long offset, + FLdLongOp f) { + //dummy; no vec = vec(); + $type$[] res = new $type$[length()]; + for (int i = 0; i < res.length; i++) { + res[i] = f.apply(memory, offset, i); + } + return vectorFactory(res); + } + + /*package-private*/ + @ForceInline + final + $abstractvectortype$ ldLongOp(MemorySegment memory, long offset, + VectorMask<$Boxtype$> m, + FLdLongOp f) { + //$type$[] vec = vec(); + $type$[] res = new $type$[length()]; + boolean[] mbits = ((AbstractMask<$Boxtype$>)m).getBits(); + for (int i = 0; i < res.length; i++) { + if (mbits[i]) { + res[i] = f.apply(memory, offset, i); + } + } + return vectorFactory(res); + } + + static $type$ memorySegmentGet(MemorySegment ms, long o, int i) { + return ms.get(ELEMENT_LAYOUT, o + i * $sizeInBytes$L); + } + interface FStOp { void apply(M memory, int offset, int i, $type$ a); } @@ -385,6 +426,40 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { } } + interface FStLongOp { + void apply(MemorySegment memory, long offset, int i, $type$ a); + } + + /*package-private*/ + @ForceInline + final + void stLongOp(MemorySegment memory, long offset, + FStLongOp f) { + $type$[] vec = vec(); + for (int i = 0; i < vec.length; i++) { + f.apply(memory, offset, i, vec[i]); + } + } + + /*package-private*/ + @ForceInline + final + void stLongOp(MemorySegment memory, long offset, + VectorMask<$Boxtype$> m, + FStLongOp f) { + $type$[] vec = vec(); + boolean[] mbits = ((AbstractMask<$Boxtype$>)m).getBits(); + for (int i = 0; i < vec.length; i++) { + if (mbits[i]) { + f.apply(memory, offset, i, vec[i]); + } + } + } + + static void memorySegmentSet(MemorySegment ms, long o, int i, $type$ e) { + ms.set(ELEMENT_LAYOUT, o + i * $sizeInBytes$L, e); + } + // Binary test /*package-private*/ @@ -445,6 +520,36 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { return {#if[FP]?$Type$.$bitstype$BitsTo$Type$}(($bitstype$)bits); } + static $abstractvectortype$ expandHelper(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) { + VectorSpecies<$Boxtype$> vsp = m.vectorSpecies(); + $abstractvectortype$ r = ($abstractvectortype$) vsp.zero(); + $abstractvectortype$ vi = ($abstractvectortype$) v; + if (m.allTrue()) { + return vi; + } + for (int i = 0, j = 0; i < vsp.length(); i++) { + if (m.laneIsSet(i)) { + r = r.withLane(i, vi.lane(j++)); + } + } + return r; + } + + static $abstractvectortype$ compressHelper(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) { + VectorSpecies<$Boxtype$> vsp = m.vectorSpecies(); + $abstractvectortype$ r = ($abstractvectortype$) vsp.zero(); + $abstractvectortype$ vi = ($abstractvectortype$) v; + if (m.allTrue()) { + return vi; + } + for (int i = 0, j = 0; i < vsp.length(); i++) { + if (m.laneIsSet(i)) { + r = r.withLane(j++, vi.lane(i)); + } + } + return r; + } + // Static factories (other than memory operations) // Note: A surprising behavior in javadoc @@ -646,6 +751,36 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { v0.uOp(m, (i, a) -> ($type$) -a); case VECTOR_OP_ABS: return (v0, m) -> v0.uOp(m, (i, a) -> ($type$) Math.abs(a)); +#if[!FP] +#if[intOrLong] + case VECTOR_OP_BIT_COUNT: return (v0, m) -> + v0.uOp(m, (i, a) -> ($type$) $Boxtype$.bitCount(a)); + case VECTOR_OP_TZ_COUNT: return (v0, m) -> + v0.uOp(m, (i, a) -> ($type$) $Boxtype$.numberOfTrailingZeros(a)); + case VECTOR_OP_LZ_COUNT: return (v0, m) -> + v0.uOp(m, (i, a) -> ($type$) $Boxtype$.numberOfLeadingZeros(a)); + case VECTOR_OP_REVERSE: return (v0, m) -> + v0.uOp(m, (i, a) -> ($type$) $Boxtype$.reverse(a)); +#else[intOrLong] + case VECTOR_OP_BIT_COUNT: return (v0, m) -> + v0.uOp(m, (i, a) -> ($type$) bitCount(a)); + case VECTOR_OP_TZ_COUNT: return (v0, m) -> + v0.uOp(m, (i, a) -> ($type$) numberOfTrailingZeros(a)); + case VECTOR_OP_LZ_COUNT: return (v0, m) -> + v0.uOp(m, (i, a) -> ($type$) numberOfLeadingZeros(a)); + case VECTOR_OP_REVERSE: return (v0, m) -> + v0.uOp(m, (i, a) -> reverse(a)); +#end[intOrLong] +#if[BITWISE] +#if[byte] + case VECTOR_OP_REVERSE_BYTES: return (v0, m) -> + v0.uOp(m, (i, a) -> a); +#else[byte] + case VECTOR_OP_REVERSE_BYTES: return (v0, m) -> + v0.uOp(m, (i, a) -> ($type$) $Boxtype$.reverseBytes(a)); +#end[byte] +#end[BITWISE] +#end[!FP] #if[FP] case VECTOR_OP_SIN: return (v0, m) -> v0.uOp(m, (i, a) -> ($type$) Math.sin(a)); @@ -839,6 +974,12 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { v0.bOp(v1, vm, (i, a, n) -> rotateLeft(a, (int)n)); case VECTOR_OP_RROTATE: return (v0, v1, vm) -> v0.bOp(v1, vm, (i, a, n) -> rotateRight(a, (int)n)); +#if[intOrLong] + case VECTOR_OP_COMPRESS_BITS: return (v0, v1, vm) -> + v0.bOp(v1, vm, (i, a, n) -> $Boxtype$.compress(a, n)); + case VECTOR_OP_EXPAND_BITS: return (v0, v1, vm) -> + v0.bOp(v1, vm, (i, a, n) -> $Boxtype$.expand(a, n)); +#end[intOrLong] #end[BITWISE] #if[FP] case VECTOR_OP_OR: return (v0, v1, vm) -> @@ -1987,6 +2128,56 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { return lanewise(ABS); } +#if[!FP] +#if[!intOrLong] + static int bitCount($type$ a) { +#if[short] + return Integer.bitCount((int)a & 0xFFFF); +#else[short] + return Integer.bitCount((int)a & 0xFF); +#end[short] + } +#end[!intOrLong] +#end[!FP] +#if[!FP] +#if[!intOrLong] + static int numberOfTrailingZeros($type$ a) { +#if[short] + return a != 0 ? Integer.numberOfTrailingZeros(a) : 16; +#else[short] + return a != 0 ? Integer.numberOfTrailingZeros(a) : 8; +#end[short] + } +#end[!intOrLong] +#end[!FP] +#if[!FP] +#if[!intOrLong] + static int numberOfLeadingZeros($type$ a) { +#if[short] + return a >= 0 ? Integer.numberOfLeadingZeros(a) - 16 : 0; +#else[short] + return a >= 0 ? Integer.numberOfLeadingZeros(a) - 24 : 0; +#end[short] + } + + static $type$ reverse($type$ a) { + if (a == 0 || a == -1) return a; + +#if[short] + $type$ b = rotateLeft(a, 8); + b = ($type$) (((b & 0x5555) << 1) | ((b & 0xAAAA) >>> 1)); + b = ($type$) (((b & 0x3333) << 2) | ((b & 0xCCCC) >>> 2)); + b = ($type$) (((b & 0x0F0F) << 4) | ((b & 0xF0F0) >>> 4)); +#else[short] + $type$ b = rotateLeft(a, 4); + b = ($type$) (((b & 0x55) << 1) | ((b & 0xAA) >>> 1)); + b = ($type$) (((b & 0x33) << 2) | ((b & 0xCC) >>> 2)); +#end[short] + return b; + } +#end[!intOrLong] +#end[!FP] + #if[BITWISE] // not (~) /** @@ -2695,6 +2886,45 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $Type$Vector::toShuffle0); } + /** + * {@inheritDoc} + * @since 19 + */ + @Override + public abstract + $Type$Vector compress(VectorMask<$Boxtype$> m); + + /*package-private*/ + @ForceInline + final + > + $Type$Vector compressTemplate(Class masktype, M m) { + m.check(masktype, this); + return ($Type$Vector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype, + $type$.class, length(), this, m, + (v1, m1) -> compressHelper(v1, m1)); + } + + /** + * {@inheritDoc} + * @since 19 + */ + @Override + public abstract + $Type$Vector expand(VectorMask<$Boxtype$> m); + + /*package-private*/ + @ForceInline + final + > + $Type$Vector expandTemplate(Class masktype, M m) { + m.check(masktype, this); + return ($Type$Vector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype, + $type$.class, length(), this, m, + (v1, m1) -> expandHelper(v1, m1)); + } + + /** * {@inheritDoc} */ @@ -3302,90 +3532,6 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { } #end[double] - /** - * Loads a vector from a byte array starting at an offset. - * Bytes are composed into primitive lane elements according - * to the specified byte order. - * The vector is arranged into lanes according to - * memory ordering. - *

    - * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

    {@code
    -     * var bb = ByteBuffer.wrap(a);
    -     * var m = species.maskAll(true);
    -     * return fromByteBuffer(species, bb, offset, bo, m);
    -     * }
    - * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - */ - @ForceInline - public static - $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, - byte[] a, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), a.length); - $Type$Species vsp = ($Type$Species) species; - return vsp.dummyVector().fromByteArray0(a, offset).maybeSwap(bo); - } - - /** - * Loads a vector from a byte array starting at an offset - * and using a mask. - * Lanes where the mask is unset are filled with the default - * value of {@code $type$} ({#if[FP]?positive }zero). - * Bytes are composed into primitive lane elements according - * to the specified byte order. - * The vector is arranged into lanes according to - * memory ordering. - *

    - * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: - *

    {@code
    -     * var bb = ByteBuffer.wrap(a);
    -     * return fromByteBuffer(species, bb, offset, bo, m);
    -     * }
    - * - * @param species species of desired vector - * @param a the byte array - * @param offset the offset into the array - * @param bo the intended byte order - * @param m the mask controlling lane selection - * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException - * if {@code offset+N*ESIZE < 0} - * or {@code offset+(N+1)*ESIZE > a.length} - * for any lane {@code N} in the vector - * where the mask is set - */ - @ForceInline - public static - $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, - byte[] a, int offset, - ByteOrder bo, - VectorMask<$Boxtype$> m) { - $Type$Species vsp = ($Type$Species) species; - if (offset >= 0 && offset <= (a.length - species.vectorByteSize())) { - return vsp.dummyVector().fromByteArray0(a, offset, m).maybeSwap(bo); - } - - // FIXME: optimize - checkMaskFromIndexSize(offset, vsp, m, $sizeInBytes$, a.length); - ByteBuffer wb = wrapper(a, bo); - return vsp.ldOp(wb, offset, (AbstractMask<$Boxtype$>)m, - (wb_, o, i) -> wb_.get{#if[byte]?(:$Type$(}o + i * $sizeInBytes$)); - } - /** * Loads a vector from an array of type {@code $type$[]} * starting at an offset. @@ -3917,44 +4063,49 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { #end[byte] /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer. + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment. * Bytes are composed into primitive lane elements according * to the specified byte order. * The vector is arranged into lanes according to * memory ordering. *

    * This method behaves as if it returns the result of calling - * {@link #fromByteBuffer(VectorSpecies,ByteBuffer,int,ByteOrder,VectorMask) - * fromByteBuffer()} as follows: + * {@link #fromMemorySegment(VectorSpecies,MemorySegment,long,ByteOrder,VectorMask) + * fromMemorySegment()} as follows: *

    {@code
          * var m = species.maskAll(true);
    -     * return fromByteBuffer(species, bb, offset, bo, m);
    +     * return fromMemorySegment(species, ms, offset, bo, m);
          * }
    * * @param species species of desired vector - * @param bb the byte buffer - * @param offset the offset into the byte buffer + * @param ms the memory segment + * @param offset the offset into the memory segment * @param bo the intended byte order - * @return a vector loaded from a byte buffer + * @return a vector loaded from the memory segment * @throws IndexOutOfBoundsException * if {@code offset+N*$sizeInBytes$ < 0} - * or {@code offset+N*$sizeInBytes$ >= bb.limit()} + * or {@code offset+N*$sizeInBytes$ >= ms.byteSize()} * for any lane {@code N} in the vector + * @throws IllegalArgumentException if the memory segment is a heap segment that is + * not backed by a {@code byte[]} array. + * @throws IllegalStateException if the memory segment's session is not alive, + * or if access occurs from a thread other than the thread owning the session. + * @since 19 */ @ForceInline public static - $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, - ByteBuffer bb, int offset, - ByteOrder bo) { - offset = checkFromIndexSize(offset, species.vectorByteSize(), bb.limit()); + $abstractvectortype$ fromMemorySegment(VectorSpecies<$Boxtype$> species, + MemorySegment ms, long offset, + ByteOrder bo) { + offset = checkFromIndexSize(offset, species.vectorByteSize(), ms.byteSize()); $Type$Species vsp = ($Type$Species) species; - return vsp.dummyVector().fromByteBuffer0(bb, offset).maybeSwap(bo); + return vsp.dummyVector().fromMemorySegment0(ms, offset).maybeSwap(bo); } /** - * Loads a vector from a {@linkplain ByteBuffer byte buffer} - * starting at an offset into the byte buffer + * Loads a vector from a {@linkplain MemorySegment memory segment} + * starting at an offset into the memory segment * and using a mask. * Lanes where the mask is unset are filled with the default * value of {@code $type$} ({#if[FP]?positive }zero). @@ -3965,15 +4116,11 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { *

    * The following pseudocode illustrates the behavior: *

    {@code
    -     * $Type$Buffer eb = bb.duplicate()
    -     *     .position(offset){#if[byte]?;}
    -#if[!byte]
    -     *     .order(bo).as$Type$Buffer();
    -#end[!byte]
    +     * var slice = ms.asSlice(offset);
          * $type$[] ar = new $type$[species.length()];
          * for (int n = 0; n < ar.length; n++) {
          *     if (m.laneIsSet(n)) {
    -     *         ar[n] = eb.get(n);
    +     *         ar[n] = slice.getAtIndex(ValuaLayout.JAVA_$TYPE$.withBitAlignment(8), n);
          *     }
          * }
          * $abstractvectortype$ r = $abstractvectortype$.fromArray(species, ar, 0);
    @@ -3991,33 +4138,36 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
     #end[!byte]
          *
          * @param species species of desired vector
    -     * @param bb the byte buffer
    -     * @param offset the offset into the byte buffer
    +     * @param ms the memory segment
    +     * @param offset the offset into the memory segment
          * @param bo the intended byte order
          * @param m the mask controlling lane selection
    -     * @return a vector loaded from a byte buffer
    +     * @return a vector loaded from the memory segment
          * @throws IndexOutOfBoundsException
          *         if {@code offset+N*$sizeInBytes$ < 0}
    -     *         or {@code offset+N*$sizeInBytes$ >= bb.limit()}
    +     *         or {@code offset+N*$sizeInBytes$ >= ms.byteSize()}
          *         for any lane {@code N} in the vector
          *         where the mask is set
    +     * @throws IllegalArgumentException if the memory segment is a heap segment that is
    +     *         not backed by a {@code byte[]} array.
    +     * @throws IllegalStateException if the memory segment's session is not alive,
    +     *         or if access occurs from a thread other than the thread owning the session.
    +     * @since 19
          */
         @ForceInline
         public static
    -    $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species,
    -                                        ByteBuffer bb, int offset,
    -                                        ByteOrder bo,
    -                                        VectorMask<$Boxtype$> m) {
    +    $abstractvectortype$ fromMemorySegment(VectorSpecies<$Boxtype$> species,
    +                                           MemorySegment ms, long offset,
    +                                           ByteOrder bo,
    +                                           VectorMask<$Boxtype$> m) {
             $Type$Species vsp = ($Type$Species) species;
    -        if (offset >= 0 && offset <= (bb.limit() - species.vectorByteSize())) {
    -            return vsp.dummyVector().fromByteBuffer0(bb, offset, m).maybeSwap(bo);
    +        if (offset >= 0 && offset <= (ms.byteSize() - species.vectorByteSize())) {
    +            return vsp.dummyVector().fromMemorySegment0(ms, offset, m).maybeSwap(bo);
             }
     
             // FIXME: optimize
    -        checkMaskFromIndexSize(offset, vsp, m, $sizeInBytes$, bb.limit());
    -        ByteBuffer wb = wrapper(bb, bo);
    -        return vsp.ldOp(wb, offset, (AbstractMask<$Boxtype$>)m,
    -                   (wb_, o, i)  -> wb_.get{#if[byte]?(:$Type$(}o + i * $sizeInBytes$));
    +        checkMaskFromIndexSize(offset, vsp, m, $sizeInBytes$, ms.byteSize());
    +        return vsp.ldLongOp(ms, offset, m, $abstractvectortype$::memorySegmentGet);
         }
     
         // Memory store operations
    @@ -4047,7 +4197,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 this,
                 a, offset,
                 (arr, off, v)
    -            -> v.stOp(arr, off,
    +            -> v.stOp(arr, (int) off,
                           (arr_, off_, i, e) -> arr_[off_ + i] = e));
         }
     
    @@ -4264,7 +4414,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 this,
                 a, offset,
                 (arr, off, v)
    -            -> v.stOp(arr, off,
    +            -> v.stOp(arr, (int) off,
                           (arr_, off_, i, e) -> arr_[off_ + i] = (char) e));
         }
     
    @@ -4423,7 +4573,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 normalized,
                 a, offset,
                 (arr, off, v)
    -            -> v.stOp(arr, off,
    +            -> v.stOp(arr, (int) off,
                           (arr_, off_, i, e) -> arr_[off_ + i] = (e & 1) != 0));
         }
     
    @@ -4562,67 +4712,40 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
     
         /**
          * {@inheritDoc} 
    +     * @since 19
          */
         @Override
         @ForceInline
         public final
    -    void intoByteArray(byte[] a, int offset,
    -                       ByteOrder bo) {
    -        offset = checkFromIndexSize(offset, byteSize(), a.length);
    -        maybeSwap(bo).intoByteArray0(a, offset);
    -    }
    -
    -    /**
    -     * {@inheritDoc} 
    -     */
    -    @Override
    -    @ForceInline
    -    public final
    -    void intoByteArray(byte[] a, int offset,
    -                       ByteOrder bo,
    -                       VectorMask<$Boxtype$> m) {
    -        if (m.allTrue()) {
    -            intoByteArray(a, offset, bo);
    -        } else {
    -            $Type$Species vsp = vspecies();
    -            checkMaskFromIndexSize(offset, vsp, m, $sizeInBytes$, a.length);
    -            maybeSwap(bo).intoByteArray0(a, offset, m);
    +    void intoMemorySegment(MemorySegment ms, long offset,
    +                           ByteOrder bo) {
    +        if (ms.isReadOnly()) {
    +            throw new UnsupportedOperationException("Attempt to write a read-only segment");
             }
    +
    +        offset = checkFromIndexSize(offset, byteSize(), ms.byteSize());
    +        maybeSwap(bo).intoMemorySegment0(ms, offset);
         }
     
         /**
          * {@inheritDoc} 
    +     * @since 19
          */
         @Override
         @ForceInline
         public final
    -    void intoByteBuffer(ByteBuffer bb, int offset,
    -                        ByteOrder bo) {
    -        if (ScopedMemoryAccess.isReadOnly(bb)) {
    -            throw new ReadOnlyBufferException();
    -        }
    -        offset = checkFromIndexSize(offset, byteSize(), bb.limit());
    -        maybeSwap(bo).intoByteBuffer0(bb, offset);
    -    }
    -
    -    /**
    -     * {@inheritDoc} 
    -     */
    -    @Override
    -    @ForceInline
    -    public final
    -    void intoByteBuffer(ByteBuffer bb, int offset,
    -                        ByteOrder bo,
    -                        VectorMask<$Boxtype$> m) {
    +    void intoMemorySegment(MemorySegment ms, long offset,
    +                           ByteOrder bo,
    +                           VectorMask<$Boxtype$> m) {
             if (m.allTrue()) {
    -            intoByteBuffer(bb, offset, bo);
    +            intoMemorySegment(ms, offset, bo);
             } else {
    -            if (bb.isReadOnly()) {
    -                throw new ReadOnlyBufferException();
    +            if (ms.isReadOnly()) {
    +                throw new UnsupportedOperationException("Attempt to write a read-only segment");
                 }
                 $Type$Species vsp = vspecies();
    -            checkMaskFromIndexSize(offset, vsp, m, $sizeInBytes$, bb.limit());
    -            maybeSwap(bo).intoByteBuffer0(bb, offset, m);
    +            checkMaskFromIndexSize(offset, vsp, m, $sizeInBytes$, ms.byteSize());
    +            maybeSwap(bo).intoMemorySegment0(ms, offset, m);
             }
         }
     
    @@ -4656,7 +4779,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
                 a, arrayAddress(a, offset),
                 a, offset, vsp,
    -            (arr, off, s) -> s.ldOp(arr, off,
    +            (arr, off, s) -> s.ldOp(arr, (int) off,
                                         (arr_, off_, i) -> arr_[off_ + i]));
         }
     
    @@ -4673,7 +4796,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
                 a, arrayAddress(a, offset), m,
                 a, offset, vsp,
    -            (arr, off, s, vm) -> s.ldOp(arr, off, vm,
    +            (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                             (arr_, off_, i) -> arr_[off_ + i]));
         }
     
    @@ -4750,7 +4873,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
                 a, charArrayAddress(a, offset),
                 a, offset, vsp,
    -            (arr, off, s) -> s.ldOp(arr, off,
    +            (arr, off, s) -> s.ldOp(arr, (int) off,
                                         (arr_, off_, i) -> (short) arr_[off_ + i]));
         }
     
    @@ -4767,7 +4890,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                     vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
                     a, charArrayAddress(a, offset), m,
                     a, offset, vsp,
    -                (arr, off, s, vm) -> s.ldOp(arr, off, vm,
    +                (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                                 (arr_, off_, i) -> (short) arr_[off_ + i]));
         }
     #end[short]
    @@ -4784,7 +4907,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
                 a, booleanArrayAddress(a, offset),
                 a, offset, vsp,
    -            (arr, off, s) -> s.ldOp(arr, off,
    +            (arr, off, s) -> s.ldOp(arr, (int) off,
                                         (arr_, off_, i) -> (byte) (arr_[off_ + i] ? 1 : 0)));
         }
     
    @@ -4801,79 +4924,38 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
                 a, booleanArrayAddress(a, offset), m,
                 a, offset, vsp,
    -            (arr, off, s, vm) -> s.ldOp(arr, off, vm,
    +            (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm,
                                             (arr_, off_, i) -> (byte) (arr_[off_ + i] ? 1 : 0)));
         }
     #end[byte]
     
    -    @Override
         abstract
    -    $abstractvectortype$ fromByteArray0(byte[] a, int offset);
    +    $abstractvectortype$ fromMemorySegment0(MemorySegment bb, long offset);
         @ForceInline
         final
    -    $abstractvectortype$ fromByteArray0Template(byte[] a, int offset) {
    +    $abstractvectortype$ fromMemorySegment0Template(MemorySegment ms, long offset) {
             $Type$Species vsp = vspecies();
    -        return VectorSupport.load(
    -            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
    -            a, byteArrayAddress(a, offset),
    -            a, offset, vsp,
    -            (arr, off, s) -> {
    -                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
    -                return s.ldOp(wb, off,
    -                        (wb_, o, i) -> wb_.get{#if[byte]?(:$Type$(}o + i * $sizeInBytes$));
    -            });
    -    }
    -
    -    abstract
    -    $abstractvectortype$ fromByteArray0(byte[] a, int offset, VectorMask<$Boxtype$> m);
    -    @ForceInline
    -    final
    -    >
    -    $abstractvectortype$ fromByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
    -        $Type$Species vsp = vspecies();
    -        m.check(vsp);
    -        return VectorSupport.loadMasked(
    -            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
    -            a, byteArrayAddress(a, offset), m,
    -            a, offset, vsp,
    -            (arr, off, s, vm) -> {
    -                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
    -                return s.ldOp(wb, off, vm,
    -                        (wb_, o, i) -> wb_.get{#if[byte]?(:$Type$(}o + i * $sizeInBytes$));
    -            });
    -    }
    -
    -    abstract
    -    $abstractvectortype$ fromByteBuffer0(ByteBuffer bb, int offset);
    -    @ForceInline
    -    final
    -    $abstractvectortype$ fromByteBuffer0Template(ByteBuffer bb, int offset) {
    -        $Type$Species vsp = vspecies();
    -        return ScopedMemoryAccess.loadFromByteBuffer(
    +        return ScopedMemoryAccess.loadFromMemorySegment(
                     vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
    -                bb, offset, vsp,
    -                (buf, off, s) -> {
    -                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
    -                    return s.ldOp(wb, off,
    -                            (wb_, o, i) -> wb_.get{#if[byte]?(:$Type$(}o + i * $sizeInBytes$));
    +                (AbstractMemorySegmentImpl) ms, offset, vsp,
    +                (msp, off, s) -> {
    +                    return s.ldLongOp((MemorySegment) msp, off, $abstractvectortype$::memorySegmentGet);
                     });
         }
     
         abstract
    -    $abstractvectortype$ fromByteBuffer0(ByteBuffer bb, int offset, VectorMask<$Boxtype$> m);
    +    $abstractvectortype$ fromMemorySegment0(MemorySegment ms, long offset, VectorMask<$Boxtype$> m);
         @ForceInline
         final
         >
    -    $abstractvectortype$ fromByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
    +    $abstractvectortype$ fromMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
             $Type$Species vsp = vspecies();
             m.check(vsp);
    -        return ScopedMemoryAccess.loadFromByteBufferMasked(
    +        return ScopedMemoryAccess.loadFromMemorySegmentMasked(
                     vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
    -                bb, offset, m, vsp,
    -                (buf, off, s, vm) -> {
    -                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
    -                    return s.ldOp(wb, off, vm,
    -                            (wb_, o, i) -> wb_.get{#if[byte]?(:$Type$(}o + i * $sizeInBytes$));
    +                (AbstractMemorySegmentImpl) ms, offset, m, vsp,
    +                (msp, off, s, vm) -> {
    +                    return s.ldLongOp((MemorySegment) msp, off, vm, $abstractvectortype$::memorySegmentGet);
                     });
         }
     
    @@ -4892,7 +4974,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 a, arrayAddress(a, offset),
                 this, a, offset,
                 (arr, off, v)
    -            -> v.stOp(arr, off,
    +            -> v.stOp(arr, (int) off,
                           (arr_, off_, i, e) -> arr_[off_+i] = e));
         }
     
    @@ -4909,7 +4991,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 a, arrayAddress(a, offset),
                 this, m, a, offset,
                 (arr, off, v, vm)
    -            -> v.stOp(arr, off, vm,
    +            -> v.stOp(arr, (int) off, vm,
                           (arr_, off_, i, e) -> arr_[off_ + i] = e));
         }
     
    @@ -4990,76 +5072,38 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 a, booleanArrayAddress(a, offset),
                 normalized, m, a, offset,
                 (arr, off, v, vm)
    -            -> v.stOp(arr, off, vm,
    +            -> v.stOp(arr, (int) off, vm,
                           (arr_, off_, i, e) -> arr_[off_ + i] = (e & 1) != 0));
         }
     #end[byte]
     
    -    abstract
    -    void intoByteArray0(byte[] a, int offset);
         @ForceInline
         final
    -    void intoByteArray0Template(byte[] a, int offset) {
    +    void intoMemorySegment0(MemorySegment ms, long offset) {
             $Type$Species vsp = vspecies();
    -        VectorSupport.store(
    -            vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
    -            a, byteArrayAddress(a, offset),
    -            this, a, offset,
    -            (arr, off, v) -> {
    -                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
    -                v.stOp(wb, off,
    -                        (tb_, o, i, e) -> tb_.put{#if[byte]?(:$Type$(}o + i * $sizeInBytes$, e));
    -            });
    -    }
    -
    -    abstract
    -    void intoByteArray0(byte[] a, int offset, VectorMask<$Boxtype$> m);
    -    @ForceInline
    -    final
    -    >
    -    void intoByteArray0Template(Class maskClass, byte[] a, int offset, M m) {
    -        $Type$Species vsp = vspecies();
    -        m.check(vsp);
    -        VectorSupport.storeMasked(
    -            vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
    -            a, byteArrayAddress(a, offset),
    -            this, m, a, offset,
    -            (arr, off, v, vm) -> {
    -                ByteBuffer wb = wrapper(arr, NATIVE_ENDIAN);
    -                v.stOp(wb, off, vm,
    -                        (tb_, o, i, e) -> tb_.put{#if[byte]?(:$Type$(}o + i * $sizeInBytes$, e));
    -            });
    -    }
    -
    -    @ForceInline
    -    final
    -    void intoByteBuffer0(ByteBuffer bb, int offset) {
    -        $Type$Species vsp = vspecies();
    -        ScopedMemoryAccess.storeIntoByteBuffer(
    +        ScopedMemoryAccess.storeIntoMemorySegment(
                     vsp.vectorType(), vsp.elementType(), vsp.laneCount(),
    -                this, bb, offset,
    -                (buf, off, v) -> {
    -                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
    -                    v.stOp(wb, off,
    -                            (wb_, o, i, e) -> wb_.put{#if[byte]?(:$Type$(}o + i * $sizeInBytes$, e));
    +                this,
    +                (AbstractMemorySegmentImpl) ms, offset,
    +                (msp, off, v) -> {
    +                    v.stLongOp((MemorySegment) msp, off, $abstractvectortype$::memorySegmentSet);
                     });
         }
     
         abstract
    -    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask<$Boxtype$> m);
    +    void intoMemorySegment0(MemorySegment bb, long offset, VectorMask<$Boxtype$> m);
         @ForceInline
         final
         >
    -    void intoByteBuffer0Template(Class maskClass, ByteBuffer bb, int offset, M m) {
    +    void intoMemorySegment0Template(Class maskClass, MemorySegment ms, long offset, M m) {
             $Type$Species vsp = vspecies();
             m.check(vsp);
    -        ScopedMemoryAccess.storeIntoByteBufferMasked(
    +        ScopedMemoryAccess.storeIntoMemorySegmentMasked(
                     vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(),
    -                this, m, bb, offset,
    -                (buf, off, v, vm) -> {
    -                    ByteBuffer wb = wrapper(buf, NATIVE_ENDIAN);
    -                    v.stOp(wb, off, vm,
    -                            (wb_, o, i, e) -> wb_.put{#if[byte]?(:$Type$(}o + i * $sizeInBytes$, e));
    +                this, m,
    +                (AbstractMemorySegmentImpl) ms, offset,
    +                (msp, off, v, vm) -> {
    +                    v.stLongOp((MemorySegment) msp, off, vm, $abstractvectortype$::memorySegmentSet);
                     });
         }
     
    @@ -5078,7 +5122,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 a, charArrayAddress(a, offset),
                 this, m, a, offset,
                 (arr, off, v, vm)
    -            -> v.stOp(arr, off, vm,
    +            -> v.stOp(arr, (int) off, vm,
                           (arr_, off_, i, e) -> arr_[off_ + i] = (char) e));
         }
     #end[short]
    @@ -5095,6 +5139,16 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 .checkIndexByLane(offset, limit, vsp.iota(), scale);
         }
     
    +    private static
    +    void checkMaskFromIndexSize(long offset,
    +                                $Type$Species vsp,
    +                                VectorMask<$Boxtype$> m,
    +                                int scale,
    +                                long limit) {
    +        ((AbstractMask<$Boxtype$>)m)
    +            .checkIndexByLane(offset, limit, vsp.iota(), scale);
    +    }
    +
         @ForceInline
         private void conditionalStoreNYI(int offset,
                                          $Type$Species vsp,
    @@ -5463,6 +5517,21 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 return dummyVector().ldOp(memory, offset, m, f);
             }
     
    +        /*package-private*/
    +        @ForceInline
    +        $abstractvectortype$ ldLongOp(MemorySegment memory, long offset,
    +                                      FLdLongOp f) {
    +            return dummyVector().ldLongOp(memory, offset, f);
    +        }
    +
    +        /*package-private*/
    +        @ForceInline
    +        $abstractvectortype$ ldLongOp(MemorySegment memory, long offset,
    +                                      VectorMask<$Boxtype$> m,
    +                                      FLdLongOp f) {
    +            return dummyVector().ldLongOp(memory, offset, m, f);
    +        }
    +
             /*package-private*/
             @ForceInline
              void stOp(M memory, int offset, FStOp f) {
    @@ -5477,6 +5546,20 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
                 dummyVector().stOp(memory, offset, m, f);
             }
     
    +        /*package-private*/
    +        @ForceInline
    +        void stLongOp(MemorySegment memory, long offset, FStLongOp f) {
    +            dummyVector().stLongOp(memory, offset, f);
    +        }
    +
    +        /*package-private*/
    +        @ForceInline
    +        void stLongOp(MemorySegment memory, long offset,
    +                      AbstractMask<$Boxtype$> m,
    +                      FStLongOp f) {
    +            dummyVector().stLongOp(memory, offset, m, f);
    +        }
    +
             // N.B. Make sure these constant vectors and
             // masks load up correctly into registers.
             //
    @@ -5590,3 +5673,4 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
         public static final VectorSpecies<$Boxtype$> SPECIES_PREFERRED
             = ($Type$Species) VectorSpecies.ofPreferred($type$.class);
     }
    +
    diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template
    index ec6e714f218..f85a333fe10 100644
    --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template
    +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template
    @@ -24,7 +24,7 @@
      */
     package jdk.incubator.vector;
     
    -import java.nio.ByteBuffer;
    +import java.lang.foreign.MemorySegment;
     import java.util.Arrays;
     import java.util.Objects;
     import java.util.function.IntUnaryOperator;
    @@ -480,6 +480,22 @@ final class $vectortype$ extends $abstractvectortype$ {
                                         ($vectortype$) v);  // specialize
         }
     
    +    @Override
    +    @ForceInline
    +    public $vectortype$ compress(VectorMask<$Boxtype$> m) {
    +        return ($vectortype$)
    +            super.compressTemplate($masktype$.class,
    +                                   ($masktype$) m);  // specialize
    +    }
    +
    +    @Override
    +    @ForceInline
    +    public $vectortype$ expand(VectorMask<$Boxtype$> m) {
    +        return ($vectortype$)
    +            super.expandTemplate($masktype$.class,
    +                                   ($masktype$) m);  // specialize
    +    }
    +
         @Override
         @ForceInline
         public $vectortype$ selectFrom(Vector<$Boxtype$> v) {
    @@ -920,6 +936,15 @@ final class $vectortype$ extends $abstractvectortype$ {
                 return xor(maskAll(true));
             }
     
    +        @Override
    +        @ForceInline
    +        public $masktype$ compress() {
    +            return ($masktype$)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS,
    +                $vectortype$.class, $masktype$.class, ETYPE, VLENGTH, null, this,
    +                (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount()));
    +        }
    +
    +
             // Binary operations
     
             @Override
    @@ -1159,29 +1184,15 @@ final class $vectortype$ extends $abstractvectortype$ {
         @ForceInline
         @Override
         final
    -    $abstractvectortype$ fromByteArray0(byte[] a, int offset) {
    -        return super.fromByteArray0Template(a, offset);  // specialize
    +    $abstractvectortype$ fromMemorySegment0(MemorySegment ms, long offset) {
    +        return super.fromMemorySegment0Template(ms, offset);  // specialize
         }
     
         @ForceInline
         @Override
         final
    -    $abstractvectortype$ fromByteArray0(byte[] a, int offset, VectorMask<$Boxtype$> m) {
    -        return super.fromByteArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
    -    }
    -
    -    @ForceInline
    -    @Override
    -    final
    -    $abstractvectortype$ fromByteBuffer0(ByteBuffer bb, int offset) {
    -        return super.fromByteBuffer0Template(bb, offset);  // specialize
    -    }
    -
    -    @ForceInline
    -    @Override
    -    final
    -    $abstractvectortype$ fromByteBuffer0(ByteBuffer bb, int offset, VectorMask<$Boxtype$> m) {
    -        return super.fromByteBuffer0Template($masktype$.class, bb, offset, ($masktype$) m);  // specialize
    +    $abstractvectortype$ fromMemorySegment0(MemorySegment ms, long offset, VectorMask<$Boxtype$> m) {
    +        return super.fromMemorySegment0Template($masktype$.class, ms, offset, ($masktype$) m);  // specialize
         }
     
         @ForceInline
    @@ -1219,22 +1230,8 @@ final class $vectortype$ extends $abstractvectortype$ {
         @ForceInline
         @Override
         final
    -    void intoByteArray0(byte[] a, int offset) {
    -        super.intoByteArray0Template(a, offset);  // specialize
    -    }
    -
    -    @ForceInline
    -    @Override
    -    final
    -    void intoByteArray0(byte[] a, int offset, VectorMask<$Boxtype$> m) {
    -        super.intoByteArray0Template($masktype$.class, a, offset, ($masktype$) m);  // specialize
    -    }
    -
    -    @ForceInline
    -    @Override
    -    final
    -    void intoByteBuffer0(ByteBuffer bb, int offset, VectorMask<$Boxtype$> m) {
    -        super.intoByteBuffer0Template($masktype$.class, bb, offset, ($masktype$) m);
    +    void intoMemorySegment0(MemorySegment ms, long offset, VectorMask<$Boxtype$> m) {
    +        super.intoMemorySegment0Template($masktype$.class, ms, offset, ($masktype$) m);
         }
     
     #if[short]
    @@ -1251,3 +1248,4 @@ final class $vectortype$ extends $abstractvectortype$ {
         // ================================================
     
     }
    +
    diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java
    index 164f2b6dac5..13bd0748c23 100644
    --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java
    +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java
    @@ -224,6 +224,8 @@ public class AMD64 extends Architecture {
             RDTSCP,
             RDPID,
             FSRM,
    +        GFNI,
    +        AVX512_BITALG,
         }
     
         private final EnumSet features;
    diff --git a/test/hotspot/gtest/aarch64/aarch64-asmtest.py b/test/hotspot/gtest/aarch64/aarch64-asmtest.py
    index c3c9543e719..f9a0b2763d9 100644
    --- a/test/hotspot/gtest/aarch64/aarch64-asmtest.py
    +++ b/test/hotspot/gtest/aarch64/aarch64-asmtest.py
    @@ -1769,6 +1769,10 @@ generate(SpecialCases, [["ccmn",   "__ ccmn(zr, zr, 3u, Assembler::LE);",
                             ["lasta",   "__ sve_lasta(v0, __ B, p0, z15);",                   "lasta\tb0, p0, z15.b"],
                             ["lastb",   "__ sve_lastb(v1, __ B, p1, z16);",                   "lastb\tb1, p1, z16.b"],
                             ["index",   "__ sve_index(z6, __ S, 1, 1);",                      "index\tz6.s, #1, #1"],
    +                        ["index",   "__ sve_index(z6, __ B, r5, 2);",                     "index\tz6.b, w5, #2"],
    +                        ["index",   "__ sve_index(z6, __ H, r5, 3);",                     "index\tz6.h, w5, #3"],
    +                        ["index",   "__ sve_index(z6, __ S, r5, 4);",                     "index\tz6.s, w5, #4"],
    +                        ["index",   "__ sve_index(z7, __ D, r5, 5);",                     "index\tz7.d, x5, #5"],
                             ["cpy",     "__ sve_cpy(z7, __ H, p3, r5);",                      "cpy\tz7.h, p3/m, w5"],
                             ["tbl",     "__ sve_tbl(z16, __ S, z17, z18);",                   "tbl\tz16.s, {z17.s}, z18.s"],
                             ["ld1w",    "__ sve_ld1w_gather(z15, p0, r5, z16);",              "ld1w\t{z15.s}, p0/z, [x5, z16.s, uxtw #2]"],
    @@ -1811,7 +1815,12 @@ generate(SpecialCases, [["ccmn",   "__ ccmn(zr, zr, 3u, Assembler::LE);",
                             ["uzp2",    "__ sve_uzp2(p0, __ D, p0, p1);",                     "uzp2\tp0.d, p0.d, p1.d"],
                             ["punpklo", "__ sve_punpklo(p1, p0);",                            "punpklo\tp1.h, p0.b"],
                             ["punpkhi", "__ sve_punpkhi(p1, p0);",                            "punpkhi\tp1.h, p0.b"],
    +                        ["compact", "__ sve_compact(z16, __ S, z16, p1);",                "compact\tz16.s, p1, z16.s"],
    +                        ["compact", "__ sve_compact(z16, __ D, z16, p1);",                "compact\tz16.d, p1, z16.d"],
                             ["ext",     "__ sve_ext(z17, z16, 63);",                          "ext\tz17.b, z17.b, z16.b, #63"],
    +                        # SVE2 instructions
    +                        ["histcnt", "__ sve_histcnt(z16, __ S, p0, z16, z16);",           "histcnt\tz16.s, p0/z, z16.s, z16.s"],
    +                        ["histcnt", "__ sve_histcnt(z17, __ D, p0, z17, z17);",           "histcnt\tz17.d, p0/z, z17.d, z17.d"],
     ])
     
     print "\n// FloatImmediateOp"
    @@ -1855,6 +1864,7 @@ generate(SVEVectorOp, [["add", "ZZZ"],
                            ["and", "ZPZ", "m", "dn"],
                            ["asr", "ZPZ", "m", "dn"],
                            ["bic", "ZPZ", "m", "dn"],
    +                       ["clz", "ZPZ", "m"],
                            ["cnt", "ZPZ", "m"],
                            ["eor", "ZPZ", "m", "dn"],
                            ["lsl", "ZPZ", "m", "dn"],
    @@ -1863,6 +1873,8 @@ generate(SVEVectorOp, [["add", "ZZZ"],
                            ["neg", "ZPZ", "m"],
                            ["not", "ZPZ", "m"],
                            ["orr", "ZPZ", "m", "dn"],
    +                       ["rbit", "ZPZ", "m"],
    +                       ["revb", "ZPZ", "m"],
                            ["smax", "ZPZ", "m", "dn"],
                            ["smin", "ZPZ", "m", "dn"],
                            ["sub", "ZPZ", "m", "dn"],
    diff --git a/test/hotspot/gtest/aarch64/asmtest.out.h b/test/hotspot/gtest/aarch64/asmtest.out.h
    index 96ed4f1a973..b6cb1790e1d 100644
    --- a/test/hotspot/gtest/aarch64/asmtest.out.h
    +++ b/test/hotspot/gtest/aarch64/asmtest.out.h
    @@ -913,6 +913,10 @@
         __ sve_lasta(v0, __ B, p0, z15);                   //       lasta   b0, p0, z15.b
         __ sve_lastb(v1, __ B, p1, z16);                   //       lastb   b1, p1, z16.b
         __ sve_index(z6, __ S, 1, 1);                      //       index   z6.s, #1, #1
    +    __ sve_index(z6, __ B, r5, 2);                     //       index   z6.b, w5, #2
    +    __ sve_index(z6, __ H, r5, 3);                     //       index   z6.h, w5, #3
    +    __ sve_index(z6, __ S, r5, 4);                     //       index   z6.s, w5, #4
    +    __ sve_index(z7, __ D, r5, 5);                     //       index   z7.d, x5, #5
         __ sve_cpy(z7, __ H, p3, r5);                      //       cpy     z7.h, p3/m, w5
         __ sve_tbl(z16, __ S, z17, z18);                   //       tbl     z16.s, {z17.s}, z18.s
         __ sve_ld1w_gather(z15, p0, r5, z16);              //       ld1w    {z15.s}, p0/z, [x5, z16.s, uxtw #2]
    @@ -955,7 +959,11 @@
         __ sve_uzp2(p0, __ D, p0, p1);                     //       uzp2    p0.d, p0.d, p1.d
         __ sve_punpklo(p1, p0);                            //       punpklo p1.h, p0.b
         __ sve_punpkhi(p1, p0);                            //       punpkhi p1.h, p0.b
    +    __ sve_compact(z16, __ S, z16, p1);                //       compact z16.s, p1, z16.s
    +    __ sve_compact(z16, __ D, z16, p1);                //       compact z16.d, p1, z16.d
         __ sve_ext(z17, z16, 63);                          //       ext     z17.b, z17.b, z16.b, #63
    +    __ sve_histcnt(z16, __ S, p0, z16, z16);           //       histcnt z16.s, p0/z, z16.s, z16.s
    +    __ sve_histcnt(z17, __ D, p0, z17, z17);           //       histcnt z17.d, p0/z, z17.d, z17.d
     
     // FloatImmediateOp
         __ fmovd(v0, 2.0);                                 //       fmov d0, #2.0
    @@ -1144,57 +1152,60 @@
         __ sve_and(z22, __ D, p5, z20);                    //       and     z22.d, p5/m, z22.d, z20.d
         __ sve_asr(z28, __ S, p2, z13);                    //       asr     z28.s, p2/m, z28.s, z13.s
         __ sve_bic(z7, __ H, p5, z28);                     //       bic     z7.h, p5/m, z7.h, z28.h
    -    __ sve_cnt(z11, __ S, p3, z11);                    //       cnt     z11.s, p3/m, z11.s
    -    __ sve_eor(z1, __ S, p6, z8);                      //       eor     z1.s, p6/m, z1.s, z8.s
    -    __ sve_lsl(z13, __ S, p4, z17);                    //       lsl     z13.s, p4/m, z13.s, z17.s
    -    __ sve_lsr(z4, __ H, p0, z3);                      //       lsr     z4.h, p0/m, z4.h, z3.h
    -    __ sve_mul(z7, __ S, p3, z14);                     //       mul     z7.s, p3/m, z7.s, z14.s
    -    __ sve_neg(z4, __ B, p3, z29);                     //       neg     z4.b, p3/m, z29.b
    -    __ sve_not(z0, __ D, p2, z21);                     //       not     z0.d, p2/m, z21.d
    -    __ sve_orr(z3, __ S, p0, z9);                      //       orr     z3.s, p0/m, z3.s, z9.s
    -    __ sve_smax(z28, __ B, p2, z24);                   //       smax    z28.b, p2/m, z28.b, z24.b
    -    __ sve_smin(z19, __ D, p1, z23);                   //       smin    z19.d, p1/m, z19.d, z23.d
    -    __ sve_sub(z13, __ D, p5, z10);                    //       sub     z13.d, p5/m, z13.d, z10.d
    -    __ sve_fabs(z12, __ D, p4, z30);                   //       fabs    z12.d, p4/m, z30.d
    -    __ sve_fadd(z14, __ D, p0, z29);                   //       fadd    z14.d, p0/m, z14.d, z29.d
    -    __ sve_fdiv(z21, __ D, p5, z7);                    //       fdiv    z21.d, p5/m, z21.d, z7.d
    -    __ sve_fmax(z2, __ D, p0, z26);                    //       fmax    z2.d, p0/m, z2.d, z26.d
    -    __ sve_fmin(z9, __ D, p4, z17);                    //       fmin    z9.d, p4/m, z9.d, z17.d
    -    __ sve_fmul(z0, __ D, p1, z2);                     //       fmul    z0.d, p1/m, z0.d, z2.d
    -    __ sve_fneg(z14, __ D, p1, z11);                   //       fneg    z14.d, p1/m, z11.d
    -    __ sve_frintm(z14, __ S, p4, z29);                 //       frintm  z14.s, p4/m, z29.s
    -    __ sve_frintn(z3, __ S, p0, z22);                  //       frintn  z3.s, p0/m, z22.s
    -    __ sve_frintp(z3, __ S, p6, z27);                  //       frintp  z3.s, p6/m, z27.s
    -    __ sve_fsqrt(z19, __ D, p5, z7);                   //       fsqrt   z19.d, p5/m, z7.d
    -    __ sve_fsub(z21, __ S, p3, z5);                    //       fsub    z21.s, p3/m, z21.s, z5.s
    -    __ sve_fmad(z25, __ D, p1, z21, z17);              //       fmad    z25.d, p1/m, z21.d, z17.d
    -    __ sve_fmla(z0, __ S, p0, z9, z19);                //       fmla    z0.s, p0/m, z9.s, z19.s
    -    __ sve_fmls(z7, __ D, p3, z14, z17);               //       fmls    z7.d, p3/m, z14.d, z17.d
    -    __ sve_fmsb(z11, __ D, p3, z24, z17);              //       fmsb    z11.d, p3/m, z24.d, z17.d
    -    __ sve_fnmad(z17, __ D, p2, z15, z14);             //       fnmad   z17.d, p2/m, z15.d, z14.d
    -    __ sve_fnmsb(z22, __ S, p7, z22, z7);              //       fnmsb   z22.s, p7/m, z22.s, z7.s
    -    __ sve_fnmla(z5, __ S, p7, z27, z10);              //       fnmla   z5.s, p7/m, z27.s, z10.s
    -    __ sve_fnmls(z14, __ S, p6, z21, z20);             //       fnmls   z14.s, p6/m, z21.s, z20.s
    -    __ sve_mla(z3, __ D, p5, z25, z5);                 //       mla     z3.d, p5/m, z25.d, z5.d
    -    __ sve_mls(z29, __ H, p4, z17, z1);                //       mls     z29.h, p4/m, z17.h, z1.h
    -    __ sve_and(z14, z29, z13);                         //       and     z14.d, z29.d, z13.d
    -    __ sve_eor(z17, z2, z30);                          //       eor     z17.d, z2.d, z30.d
    -    __ sve_orr(z22, z21, z29);                         //       orr     z22.d, z21.d, z29.d
    -    __ sve_bic(z8, z2, z0);                            //       bic     z8.d, z2.d, z0.d
    -    __ sve_uzp1(z23, __ S, z22, z0);                   //       uzp1    z23.s, z22.s, z0.s
    -    __ sve_uzp2(z25, __ H, z26, z23);                  //       uzp2    z25.h, z26.h, z23.h
    -    __ sve_bext(z21, __ B, z21, z1);                   //       bext    z21.b, z21.b, z1.b
    +    __ sve_clz(z11, __ S, p3, z11);                    //       clz     z11.s, p3/m, z11.s
    +    __ sve_cnt(z1, __ S, p6, z8);                      //       cnt     z1.s, p6/m, z8.s
    +    __ sve_eor(z13, __ S, p4, z17);                    //       eor     z13.s, p4/m, z13.s, z17.s
    +    __ sve_lsl(z4, __ H, p0, z3);                      //       lsl     z4.h, p0/m, z4.h, z3.h
    +    __ sve_lsr(z7, __ S, p3, z14);                     //       lsr     z7.s, p3/m, z7.s, z14.s
    +    __ sve_mul(z4, __ B, p3, z29);                     //       mul     z4.b, p3/m, z4.b, z29.b
    +    __ sve_neg(z0, __ D, p2, z21);                     //       neg     z0.d, p2/m, z21.d
    +    __ sve_not(z3, __ S, p0, z9);                      //       not     z3.s, p0/m, z9.s
    +    __ sve_orr(z28, __ B, p2, z24);                    //       orr     z28.b, p2/m, z28.b, z24.b
    +    __ sve_rbit(z19, __ D, p1, z23);                   //       rbit    z19.d, p1/m, z23.d
    +    __ sve_revb(z13, __ D, p5, z10);                   //       revb    z13.d, p5/m, z10.d
    +    __ sve_smax(z12, __ S, p4, z30);                   //       smax    z12.s, p4/m, z12.s, z30.s
    +    __ sve_smin(z14, __ S, p0, z29);                   //       smin    z14.s, p0/m, z14.s, z29.s
    +    __ sve_sub(z21, __ S, p5, z7);                     //       sub     z21.s, p5/m, z21.s, z7.s
    +    __ sve_fabs(z2, __ D, p0, z26);                    //       fabs    z2.d, p0/m, z26.d
    +    __ sve_fadd(z9, __ D, p4, z17);                    //       fadd    z9.d, p4/m, z9.d, z17.d
    +    __ sve_fdiv(z0, __ D, p1, z2);                     //       fdiv    z0.d, p1/m, z0.d, z2.d
    +    __ sve_fmax(z14, __ D, p1, z11);                   //       fmax    z14.d, p1/m, z14.d, z11.d
    +    __ sve_fmin(z14, __ S, p4, z29);                   //       fmin    z14.s, p4/m, z14.s, z29.s
    +    __ sve_fmul(z3, __ S, p0, z22);                    //       fmul    z3.s, p0/m, z3.s, z22.s
    +    __ sve_fneg(z3, __ S, p6, z27);                    //       fneg    z3.s, p6/m, z27.s
    +    __ sve_frintm(z19, __ D, p5, z7);                  //       frintm  z19.d, p5/m, z7.d
    +    __ sve_frintn(z21, __ S, p3, z5);                  //       frintn  z21.s, p3/m, z5.s
    +    __ sve_frintp(z25, __ D, p1, z21);                 //       frintp  z25.d, p1/m, z21.d
    +    __ sve_fsqrt(z17, __ S, p0, z3);                   //       fsqrt   z17.s, p0/m, z3.s
    +    __ sve_fsub(z19, __ S, p3, z7);                    //       fsub    z19.s, p3/m, z19.s, z7.s
    +    __ sve_fmad(z14, __ S, p4, z17, z11);              //       fmad    z14.s, p4/m, z17.s, z11.s
    +    __ sve_fmla(z24, __ S, p4, z30, z17);              //       fmla    z24.s, p4/m, z30.s, z17.s
    +    __ sve_fmls(z15, __ D, p3, z26, z22);              //       fmls    z15.d, p3/m, z26.d, z22.d
    +    __ sve_fmsb(z22, __ D, p2, z8, z5);                //       fmsb    z22.d, p2/m, z8.d, z5.d
    +    __ sve_fnmad(z27, __ D, p2, z0, z14);              //       fnmad   z27.d, p2/m, z0.d, z14.d
    +    __ sve_fnmsb(z21, __ D, p5, z0, z3);               //       fnmsb   z21.d, p5/m, z0.d, z3.d
    +    __ sve_fnmla(z25, __ D, p1, z25, z29);             //       fnmla   z25.d, p1/m, z25.d, z29.d
    +    __ sve_fnmls(z17, __ D, p0, z12, z14);             //       fnmls   z17.d, p0/m, z12.d, z14.d
    +    __ sve_mla(z13, __ D, p0, z17, z2);                //       mla     z13.d, p0/m, z17.d, z2.d
    +    __ sve_mls(z20, __ H, p5, z21, z29);               //       mls     z20.h, p5/m, z21.h, z29.h
    +    __ sve_and(z8, z2, z0);                            //       and     z8.d, z2.d, z0.d
    +    __ sve_eor(z23, z22, z0);                          //       eor     z23.d, z22.d, z0.d
    +    __ sve_orr(z25, z26, z23);                         //       orr     z25.d, z26.d, z23.d
    +    __ sve_bic(z21, z21, z1);                          //       bic     z21.d, z21.d, z1.d
    +    __ sve_uzp1(z10, __ S, z19, z11);                  //       uzp1    z10.s, z19.s, z11.s
    +    __ sve_uzp2(z23, __ D, z23, z8);                   //       uzp2    z23.d, z23.d, z8.d
    +    __ sve_bext(z17, __ S, z19, z19);                  //       bext    z17.s, z19.s, z19.s
     
     // SVEReductionOp
    -    __ sve_andv(v10, __ S, p5, z11);                   //       andv s10, p5, z11.s
    -    __ sve_orv(v23, __ D, p6, z8);                     //       orv d23, p6, z8.d
    -    __ sve_eorv(v17, __ S, p5, z19);                   //       eorv s17, p5, z19.s
    -    __ sve_smaxv(v4, __ D, p5, z13);                   //       smaxv d4, p5, z13.d
    -    __ sve_sminv(v22, __ D, p7, z30);                  //       sminv d22, p7, z30.d
    -    __ sve_fminv(v17, __ S, p4, z14);                  //       fminv s17, p4, z14.s
    -    __ sve_fmaxv(v12, __ S, p7, z20);                  //       fmaxv s12, p7, z20.s
    -    __ sve_fadda(v1, __ S, p3, z13);                   //       fadda s1, p3, s1, z13.s
    -    __ sve_uaddv(v7, __ S, p2, z11);                   //       uaddv d7, p2, z11.s
    +    __ sve_andv(v4, __ D, p5, z13);                    //       andv d4, p5, z13.d
    +    __ sve_orv(v22, __ D, p7, z30);                    //       orv d22, p7, z30.d
    +    __ sve_eorv(v17, __ H, p4, z14);                   //       eorv h17, p4, z14.h
    +    __ sve_smaxv(v12, __ B, p7, z20);                  //       smaxv b12, p7, z20.b
    +    __ sve_sminv(v1, __ B, p3, z13);                   //       sminv b1, p3, z13.b
    +    __ sve_fminv(v7, __ D, p2, z11);                   //       fminv d7, p2, z11.d
    +    __ sve_fmaxv(v4, __ S, p6, z15);                   //       fmaxv s4, p6, z15.s
    +    __ sve_fadda(v3, __ D, p7, z0);                    //       fadda d3, p7, d3, z0.d
    +    __ sve_uaddv(v5, __ D, p5, z30);                   //       uaddv d5, p5, z30.d
     
         __ bind(forth);
     
    @@ -1213,30 +1224,30 @@
         0x9101a1a0,     0xb10a5cc8,     0xd10810aa,     0xf10fd061,
         0x120cb166,     0x321764bc,     0x52174681,     0x720c0227,
         0x9241018e,     0xb25a2969,     0xd278b411,     0xf26aad01,
    -    0x14000000,     0x17ffffd7,     0x140003e5,     0x94000000,
    -    0x97ffffd4,     0x940003e2,     0x3400000a,     0x34fffa2a,
    -    0x34007bea,     0x35000008,     0x35fff9c8,     0x35007b88,
    -    0xb400000b,     0xb4fff96b,     0xb4007b2b,     0xb500001d,
    -    0xb5fff91d,     0xb5007add,     0x10000013,     0x10fff8b3,
    -    0x10007a73,     0x90000013,     0x36300016,     0x3637f836,
    -    0x363079f6,     0x3758000c,     0x375ff7cc,     0x3758798c,
    +    0x14000000,     0x17ffffd7,     0x140003f0,     0x94000000,
    +    0x97ffffd4,     0x940003ed,     0x3400000a,     0x34fffa2a,
    +    0x34007d4a,     0x35000008,     0x35fff9c8,     0x35007ce8,
    +    0xb400000b,     0xb4fff96b,     0xb4007c8b,     0xb500001d,
    +    0xb5fff91d,     0xb5007c3d,     0x10000013,     0x10fff8b3,
    +    0x10007bd3,     0x90000013,     0x36300016,     0x3637f836,
    +    0x36307b56,     0x3758000c,     0x375ff7cc,     0x37587aec,
         0x128313a0,     0x528a32c7,     0x7289173b,     0x92ab3acc,
         0xd2a0bf94,     0xf2c285e8,     0x9358722f,     0x330e652f,
         0x53067f3b,     0x93577c53,     0xb34a1aac,     0xd35a4016,
         0x13946c63,     0x93c3dbc8,     0x54000000,     0x54fff5a0,
    -    0x54007760,     0x54000001,     0x54fff541,     0x54007701,
    -    0x54000002,     0x54fff4e2,     0x540076a2,     0x54000002,
    -    0x54fff482,     0x54007642,     0x54000003,     0x54fff423,
    -    0x540075e3,     0x54000003,     0x54fff3c3,     0x54007583,
    -    0x54000004,     0x54fff364,     0x54007524,     0x54000005,
    -    0x54fff305,     0x540074c5,     0x54000006,     0x54fff2a6,
    -    0x54007466,     0x54000007,     0x54fff247,     0x54007407,
    -    0x54000008,     0x54fff1e8,     0x540073a8,     0x54000009,
    -    0x54fff189,     0x54007349,     0x5400000a,     0x54fff12a,
    -    0x540072ea,     0x5400000b,     0x54fff0cb,     0x5400728b,
    -    0x5400000c,     0x54fff06c,     0x5400722c,     0x5400000d,
    -    0x54fff00d,     0x540071cd,     0x5400000e,     0x54ffefae,
    -    0x5400716e,     0x5400000f,     0x54ffef4f,     0x5400710f,
    +    0x540078c0,     0x54000001,     0x54fff541,     0x54007861,
    +    0x54000002,     0x54fff4e2,     0x54007802,     0x54000002,
    +    0x54fff482,     0x540077a2,     0x54000003,     0x54fff423,
    +    0x54007743,     0x54000003,     0x54fff3c3,     0x540076e3,
    +    0x54000004,     0x54fff364,     0x54007684,     0x54000005,
    +    0x54fff305,     0x54007625,     0x54000006,     0x54fff2a6,
    +    0x540075c6,     0x54000007,     0x54fff247,     0x54007567,
    +    0x54000008,     0x54fff1e8,     0x54007508,     0x54000009,
    +    0x54fff189,     0x540074a9,     0x5400000a,     0x54fff12a,
    +    0x5400744a,     0x5400000b,     0x54fff0cb,     0x540073eb,
    +    0x5400000c,     0x54fff06c,     0x5400738c,     0x5400000d,
    +    0x54fff00d,     0x5400732d,     0x5400000e,     0x54ffefae,
    +    0x540072ce,     0x5400000f,     0x54ffef4f,     0x5400726f,
         0xd40658e1,     0xd4014d22,     0xd4046543,     0xd4273f60,
         0xd44cad80,     0xd503201f,     0xd503203f,     0xd503205f,
         0xd503209f,     0xd50320bf,     0xd503219f,     0xd50323bf,
    @@ -1401,7 +1412,8 @@
         0x6554ac26,     0x6556ac26,     0x6552ac26,     0x65cbac85,
         0x65caac01,     0x65dea833,     0x659ca509,     0x65d8a801,
         0x65dcac01,     0x655cb241,     0x0520a1e0,     0x0521a601,
    -    0x052281e0,     0x05238601,     0x04a14026,     0x0568aca7,
    +    0x052281e0,     0x05238601,     0x04a14026,     0x042244a6,
    +    0x046344a6,     0x04a444a6,     0x04e544a7,     0x0568aca7,
         0x05b23230,     0x853040af,     0xc5b040af,     0xe57080af,
         0xe5b080af,     0x25034440,     0x254054c4,     0x25034640,
         0x25415a05,     0x25834440,     0x25c54489,     0x250b5d3a,
    @@ -1412,7 +1424,8 @@
         0x25d8e104,     0x25d8e184,     0x2518e407,     0x05214800,
         0x05614800,     0x05a14800,     0x05e14800,     0x05214c00,
         0x05614c00,     0x05a14c00,     0x05e14c00,     0x05304001,
    -    0x05314001,     0x05271e11,     0x1e601000,     0x1e603000,
    +    0x05314001,     0x05a18610,     0x05e18610,     0x05271e11,
    +    0x45b0c210,     0x45f1c231,     0x1e601000,     0x1e603000,
         0x1e621000,     0x1e623000,     0x1e641000,     0x1e643000,
         0x1e661000,     0x1e663000,     0x1e681000,     0x1e683000,
         0x1e6a1000,     0x1e6a3000,     0x1e6c1000,     0x1e6c3000,
    @@ -1450,18 +1463,19 @@
         0x25a1de96,     0x05808874,     0x05423bb1,     0x050030e4,
         0x04680102,     0x04be0638,     0x658103c4,     0x65800993,
         0x65910707,     0x04d6a53b,     0x04c00e17,     0x04da1696,
    -    0x049089bc,     0x045b1787,     0x049aad6b,     0x04991901,
    -    0x0493922d,     0x04518064,     0x04900dc7,     0x0417afa4,
    -    0x04deaaa0,     0x04980123,     0x04080b1c,     0x04ca06f3,
    -    0x04c1154d,     0x04dcb3cc,     0x65c083ae,     0x65cd94f5,
    -    0x65c68342,     0x65c79229,     0x65c28440,     0x04dda56e,
    -    0x6582b3ae,     0x6580a2c3,     0x6581bb63,     0x65cdb4f3,
    -    0x65818cb5,     0x65f186b9,     0x65b30120,     0x65f12dc7,
    -    0x65f1af0b,     0x65eec9f1,     0x65a7fed6,     0x65aa5f65,
    -    0x65b47aae,     0x04c55723,     0x0441723d,     0x042d33ae,
    -    0x04be3051,     0x047d32b6,     0x04e03048,     0x05a06ad7,
    -    0x05776f59,     0x4501b2b5,     0x049a356a,     0x04d83917,
    -    0x04993671,     0x04c835a4,     0x04ca3fd6,     0x658731d1,
    -    0x65863e8c,     0x65982da1,     0x04812967,
    +    0x049089bc,     0x045b1787,     0x0499ad6b,     0x049ab901,
    +    0x0499122d,     0x04538064,     0x04918dc7,     0x04100fa4,
    +    0x04d7aaa0,     0x049ea123,     0x04180b1c,     0x05e786f3,
    +    0x05e4954d,     0x048813cc,     0x048a03ae,     0x048114f5,
    +    0x04dca342,     0x65c09229,     0x65cd8440,     0x65c6856e,
    +    0x658793ae,     0x658282c3,     0x049dbb63,     0x65c2b4f3,
    +    0x6580acb5,     0x65c1a6b9,     0x658da071,     0x65818cf3,
    +    0x65ab922e,     0x65b113d8,     0x65f62f4f,     0x65e5a916,
    +    0x65eec81b,     0x65e3f415,     0x65fd4739,     0x65ee6191,
    +    0x04c2422d,     0x045d76b4,     0x04203048,     0x04a032d7,
    +    0x04773359,     0x04e132b5,     0x05ab6a6a,     0x05e86ef7,
    +    0x4593b271,     0x04da35a4,     0x04d83fd6,     0x045931d1,
    +    0x04083e8c,     0x040a2da1,     0x65c72967,     0x658639e4,
    +    0x65d83c03,     0x04c137c5,
       };
     // END  Generated code -- do not edit
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestIntrinsicBailOut.java b/test/hotspot/jtreg/compiler/vectorapi/TestIntrinsicBailOut.java
    index 5b1a31219e7..ddd47c9d56c 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/TestIntrinsicBailOut.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/TestIntrinsicBailOut.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
    + * Copyright (C) 2021, 2022, THL A29 Limited, a Tencent company. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -23,11 +23,13 @@
     
     package compiler.vectorapi;
     
    +import java.lang.foreign.MemorySegment;
     import jdk.incubator.vector.*;
     import java.nio.ByteOrder;
     
     /*
      * @test
    + * @enablePreview
      * @bug 8262998
      * @summary Vector API intrinsincs should not modify IR when bailing out
      * @modules jdk.incubator.vector
    @@ -40,13 +42,15 @@ public class TestIntrinsicBailOut {
       static final VectorSpecies SPECIES256 = DoubleVector.SPECIES_256;
       static byte[] a = new byte[512];
       static byte[] r = new byte[512];
    +  static MemorySegment msa = MemorySegment.ofArray(a);
    +  static MemorySegment msr = MemorySegment.ofArray(r);
     
       static void test() {
    -    DoubleVector av = DoubleVector.fromByteArray(SPECIES256, a, 0, ByteOrder.BIG_ENDIAN);
    -    av.intoByteArray(r, 0, ByteOrder.BIG_ENDIAN);
    +    DoubleVector av = DoubleVector.fromMemorySegment(SPECIES256, msa, 0, ByteOrder.BIG_ENDIAN);
    +    av.intoMemorySegment(msr, 0, ByteOrder.BIG_ENDIAN);
     
    -    DoubleVector bv = DoubleVector.fromByteArray(SPECIES256, a, 32, ByteOrder.LITTLE_ENDIAN);
    -    bv.intoByteArray(r, 32, ByteOrder.LITTLE_ENDIAN);
    +    DoubleVector bv = DoubleVector.fromMemorySegment(SPECIES256, msa, 32, ByteOrder.LITTLE_ENDIAN);
    +    bv.intoMemorySegment(msr, 32, ByteOrder.LITTLE_ENDIAN);
       }
     
       public static void main(String[] args) {
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestVectorErgonomics.java b/test/hotspot/jtreg/compiler/vectorapi/TestVectorErgonomics.java
    index eb25472370f..c15c38af64d 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/TestVectorErgonomics.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/TestVectorErgonomics.java
    @@ -38,42 +38,42 @@ public class TestVectorErgonomics {
     
         public static void main(String[] args) throws Throwable {
             ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
    -                                    "-XX:+EnableVectorReboxing", "-Xlog:compilation", "-version")
    +                                    "-XX:+EnableVectorReboxing", "-Xlog:compilation", "-version", "--enable-preview")
                         .shouldHaveExitValue(0)
                         .shouldContain("EnableVectorReboxing=true");
     
             ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
    -                                    "-XX:+EnableVectorAggressiveReboxing", "-Xlog:compilation", "-version")
    +                                    "-XX:+EnableVectorAggressiveReboxing", "-Xlog:compilation", "-version", "--enable-preview")
                         .shouldHaveExitValue(0)
                         .shouldContain("EnableVectorAggressiveReboxing=true");
     
             ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
    -                                    "-XX:-EnableVectorReboxing", "-Xlog:compilation", "-version")
    +                                    "-XX:-EnableVectorReboxing", "-Xlog:compilation", "-version", "--enable-preview")
                         .shouldHaveExitValue(0)
                         .shouldContain("EnableVectorReboxing=false")
                         .shouldContain("EnableVectorAggressiveReboxing=false");
     
             ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
    -                                    "-XX:-EnableVectorAggressiveReboxing", "-Xlog:compilation", "-version")
    +                                    "-XX:-EnableVectorAggressiveReboxing", "-Xlog:compilation", "-version", "--enable-preview")
                         .shouldHaveExitValue(0)
                         .shouldContain("EnableVectorAggressiveReboxing=false");
     
             ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
    -                                    "-XX:-EnableVectorSupport", "-Xlog:compilation", "-version")
    +                                    "-XX:-EnableVectorSupport", "-Xlog:compilation", "-version", "--enable-preview")
                         .shouldHaveExitValue(0)
                         .shouldContain("EnableVectorSupport=false")
                         .shouldContain("EnableVectorReboxing=false")
                         .shouldContain("EnableVectorAggressiveReboxing=false");
     
             ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
    -                                    "-XX:-EnableVectorSupport", "-XX:+EnableVectorReboxing", "-Xlog:compilation", "-version")
    +                                    "-XX:-EnableVectorSupport", "-XX:+EnableVectorReboxing", "-Xlog:compilation", "-version", "--enable-preview")
                         .shouldHaveExitValue(0)
                         .shouldContain("EnableVectorSupport=false")
                         .shouldContain("EnableVectorReboxing=false")
                         .shouldContain("EnableVectorAggressiveReboxing=false");
     
             ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
    -                                    "-XX:-EnableVectorSupport", "-XX:+EnableVectorAggressiveReboxing", "-Xlog:compilation", "-version")
    +                                    "-XX:-EnableVectorSupport", "-XX:+EnableVectorAggressiveReboxing", "-Xlog:compilation", "-version", "--enable-preview")
                         .shouldHaveExitValue(0)
                         .shouldContain("EnableVectorSupport=false")
                         .shouldContain("EnableVectorReboxing=false")
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/VectorMemoryAlias.java b/test/hotspot/jtreg/compiler/vectorapi/VectorMemoryAlias.java
    index 54637eb6e2e..9dde0aee021 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/VectorMemoryAlias.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/VectorMemoryAlias.java
    @@ -1,5 +1,5 @@
     /*
    - *  Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
    + *  Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
      *  Copyright (c) 2021, Rado Smogura. All rights reserved.
      *
      *  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    @@ -26,6 +26,7 @@
     
     /*
      * @test
    + * @enablePreview
      * @summary Test if memory ordering is preserved
      *
      * @run main/othervm -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure
    @@ -36,8 +37,8 @@
     
     package compiler.vectorapi;
     
    -import java.nio.ByteBuffer;
     import java.nio.ByteOrder;
    +import java.lang.foreign.MemorySegment;
     import jdk.incubator.vector.ByteVector;
     import jdk.incubator.vector.VectorSpecies;
     
    @@ -53,13 +54,13 @@ public class VectorMemoryAlias {
     
       public static int test() {
         byte arr[] = new byte[256];
    -    final var bb = ByteBuffer.wrap(arr);
    +    final var ms = MemorySegment.ofArray(arr);
         final var ones = ByteVector.broadcast(SPECIES, 1);
         var res = ByteVector.zero(SPECIES);
     
         int result = 0;
         result += arr[2];
    -    res.add(ones).intoByteBuffer(bb, 0, ByteOrder.nativeOrder());
    +    res.add(ones).intoMemorySegment(ms, 0L, ByteOrder.nativeOrder());
         result += arr[2];
     
         return result;
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/VectorRebracket128Test.java b/test/hotspot/jtreg/compiler/vectorapi/VectorRebracket128Test.java
    index fc18b08656c..d9fcd7a860b 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/VectorRebracket128Test.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/VectorRebracket128Test.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -20,30 +20,28 @@
      * or visit www.oracle.com if you need additional information or have any
      * questions.
      */
    -import jdk.incubator.vector.*;
    -import jdk.internal.vm.annotation.ForceInline;
     import org.testng.Assert;
     import org.testng.annotations.Test;
     import org.testng.annotations.DataProvider;
     
    -import java.lang.invoke.MethodHandles;
    -import java.lang.invoke.VarHandle;
     import java.nio.ByteOrder;
     import java.util.Arrays;
     import java.util.List;
     import java.util.function.IntFunction;
     import java.util.function.IntUnaryOperator;
    -import jdk.incubator.vector.VectorShape;
    -import jdk.incubator.vector.VectorSpecies;
    +
    +import java.lang.foreign.MemorySegment;
    +import jdk.incubator.vector.*;
     import jdk.internal.vm.annotation.ForceInline;
     
     /*
      * @test id=Z
      * @bug 8260473
    + * @enablePreview
      * @requires vm.gc.Z
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.vm.annotation
    - * @run testng/othervm -XX:CompileCommand=compileonly,jdk/incubator/vector/ByteVector.fromByteBuffer
    + * @run testng/othervm -XX:CompileCommand=compileonly,jdk/incubator/vector/ByteVector.fromMemorySegment
      *      -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+UseZGC -Xbatch -Xmx256m VectorRebracket128Test
      */
     
    @@ -124,8 +122,10 @@ public class VectorRebracket128Test {
     
         @ForceInline
         static 
    -    void testVectorRebracket(VectorSpecies a, VectorSpecies b, byte[] input, byte[] output) {
    -        Vector av = a.fromByteArray(input, 0, ByteOrder.nativeOrder());
    +    void testVectorRebracket(VectorSpecies a, VectorSpecies b,
    +                             byte[] input, byte[] output,
    +                             MemorySegment msInput, MemorySegment msOutput) {
    +        Vector av = a.fromMemorySegment(msInput, 0, ByteOrder.nativeOrder());
             int block;
             assert(input.length == output.length);
     
    @@ -139,7 +139,7 @@ public class VectorRebracket128Test {
     
             int part = 0;
             Vector bv = av.reinterpretShape(b, part);
    -        bv.intoByteArray(output, 0, ByteOrder.nativeOrder());
    +        bv.intoMemorySegment(msOutput, 0, ByteOrder.nativeOrder());
             // in-place copy, no resize
             expected = input;
             origin = 0;
    @@ -152,10 +152,12 @@ public class VectorRebracket128Test {
         static void testRebracket128(IntFunction fa) {
             byte[] barr = fa.apply(128/Byte.SIZE);
             byte[] bout = new byte[barr.length];
    +        MemorySegment msin = MemorySegment.ofArray(barr);
    +        MemorySegment msout = MemorySegment.ofArray(bout);
             for (int i = 0; i < NUM_ITER; i++) {
    -            testVectorRebracket(bspec128, bspec128, barr, bout);
    -            testVectorRebracket(bspec128, sspec128, barr, bout);
    -            testVectorRebracket(bspec128, ispec128, barr, bout);
    +            testVectorRebracket(bspec128, bspec128, barr, bout, msin, msout);
    +            testVectorRebracket(bspec128, sspec128, barr, bout, msin, msout);
    +            testVectorRebracket(bspec128, ispec128, barr, bout, msin, msout);
             }
         }
     
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX1.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX1.java
    index de70b3ca6a7..1312ef3c46c 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX1.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX1.java
    @@ -30,13 +30,14 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper;
     /*
      * @test
      * @bug 8259610
    + * @enablePreview
      * @key randomness
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.misc
      * @summary Test that vector cast intrinsics work as intended on avx1.
      * @requires vm.cpu.features ~= ".*avx.*"
      * @library /test/lib /
    - * @run driver compiler.vectorapi.reshape.TestVectorCastAVX1
    + * @run main compiler.vectorapi.reshape.TestVectorCastAVX1
      */
     public class TestVectorCastAVX1 {
         public static void main(String[] args) {
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX2.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX2.java
    index f05f8903355..a963f5b5bab 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX2.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX2.java
    @@ -30,13 +30,14 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper;
     /*
      * @test
      * @bug 8259610
    + * @enablePreview
      * @key randomness
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.misc
      * @summary Test that vector cast intrinsics work as intended on avx2.
      * @requires vm.cpu.features ~= ".*avx2.*"
      * @library /test/lib /
    - * @run driver compiler.vectorapi.reshape.TestVectorCastAVX2
    + * @run main compiler.vectorapi.reshape.TestVectorCastAVX2
      */
     public class TestVectorCastAVX2 {
         public static void main(String[] args) {
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512.java
    index a231889b9ed..10becff9be3 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512.java
    @@ -30,13 +30,14 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper;
     /*
      * @test
      * @bug 8259610
    + * @enablePreview
      * @key randomness
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.misc
      * @summary Test that vector cast intrinsics work as intended on avx512.
      * @requires vm.cpu.features ~= ".*avx512.*"
      * @library /test/lib /
    - * @run driver compiler.vectorapi.reshape.TestVectorCastAVX512
    + * @run main compiler.vectorapi.reshape.TestVectorCastAVX512
      */
     public class TestVectorCastAVX512 {
         public static void main(String[] args) {
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512BW.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512BW.java
    index c8d907db43b..258241fe660 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512BW.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512BW.java
    @@ -30,13 +30,14 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper;
     /*
      * @test
      * @bug 8278623
    + * @enablePreview
      * @key randomness
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.misc
      * @summary Test that vector cast intrinsics work as intended on avx512bw.
      * @requires vm.cpu.features ~= ".*avx512bw.*"
      * @library /test/lib /
    - * @run driver compiler.vectorapi.reshape.TestVectorCastAVX512BW
    + * @run main compiler.vectorapi.reshape.TestVectorCastAVX512BW
      */
     public class TestVectorCastAVX512BW {
         public static void main(String[] args) {
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512DQ.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512DQ.java
    index 9d8b7db7a85..359e32b6b71 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512DQ.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastAVX512DQ.java
    @@ -30,13 +30,14 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper;
     /*
      * @test
      * @bug 8259610
    + * @enablePreview
      * @key randomness
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.misc
      * @summary Test that vector cast intrinsics work as intended on avx512dq.
      * @requires vm.cpu.features ~= ".*avx512dq.*"
      * @library /test/lib /
    - * @run driver compiler.vectorapi.reshape.TestVectorCastAVX512DQ
    + * @run main compiler.vectorapi.reshape.TestVectorCastAVX512DQ
      */
     public class TestVectorCastAVX512DQ {
         public static void main(String[] args) {
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastNeon.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastNeon.java
    index 1beefec1124..f671b31a5af 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastNeon.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastNeon.java
    @@ -30,13 +30,14 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper;
     /*
      * @test
      * @bug 8259610
    + * @enablePreview
      * @key randomness
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.misc
      * @summary Test that vector cast intrinsics work as intended on neon.
      * @requires vm.cpu.features ~= ".*simd.*"
      * @library /test/lib /
    - * @run driver compiler.vectorapi.reshape.TestVectorCastNeon
    + * @run main compiler.vectorapi.reshape.TestVectorCastNeon
      */
     public class TestVectorCastNeon {
         public static void main(String[] args) {
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastSVE.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastSVE.java
    index 1ab1c3ca188..48aff2b0ffd 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastSVE.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastSVE.java
    @@ -30,13 +30,14 @@ import compiler.vectorapi.reshape.utils.VectorReshapeHelper;
     /*
      * @test
      * @bug 8259610
    + * @enablePreview
      * @key randomness
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.misc
      * @summary Test that vector cast intrinsics work as intended on sve.
      * @requires vm.cpu.features ~= ".*sve.*"
      * @library /test/lib /
    - * @run driver compiler.vectorapi.reshape.TestVectorCastSVE
    + * @run main compiler.vectorapi.reshape.TestVectorCastSVE
      */
     public class TestVectorCastSVE {
         public static void main(String[] args) {
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorReinterpret.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorReinterpret.java
    index 11821a6b8eb..3876da893d6 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorReinterpret.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorReinterpret.java
    @@ -36,11 +36,12 @@ import jdk.incubator.vector.VectorSpecies;
      * @test
      * @bug 8259610
      * @key randomness
    + * @enablePreview
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.misc
      * @summary Test that vector reinterpret intrinsics work as intended.
      * @library /test/lib /
    - * @run driver compiler.vectorapi.reshape.TestVectorReinterpret
    + * @run main compiler.vectorapi.reshape.TestVectorReinterpret
      */
     public class TestVectorReinterpret {
         private static final List SHAPE_LIST = List.of(VectorShape.values());
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/tests/TestVectorDoubleExpandShrink.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/tests/TestVectorDoubleExpandShrink.java
    index 1056cfedcfc..91b7113ac14 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/tests/TestVectorDoubleExpandShrink.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/tests/TestVectorDoubleExpandShrink.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -26,6 +26,7 @@ package compiler.vectorapi.reshape.tests;
     import compiler.lib.ir_framework.IR;
     import compiler.lib.ir_framework.Run;
     import compiler.lib.ir_framework.Test;
    +import java.lang.foreign.MemorySegment;
     
     import static compiler.vectorapi.reshape.utils.VectorReshapeHelper.*;
     
    @@ -38,7 +39,7 @@ import static compiler.vectorapi.reshape.utils.VectorReshapeHelper.*;
     public class TestVectorDoubleExpandShrink {
         @Test
         @IR(failOn = REINTERPRET_NODE)
    -    public static void testB64toB128(byte[] input, byte[] output) {
    +    public static void testB64toB128(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC64, BSPEC128, input, output);
         }
     
    @@ -49,7 +50,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(failOn = REINTERPRET_NODE)
    -    public static void testB64toB256(byte[] input, byte[] output) {
    +    public static void testB64toB256(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC64, BSPEC256, input, output);
         }
     
    @@ -60,7 +61,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(failOn = REINTERPRET_NODE)
    -    public static void testB64toB512(byte[] input, byte[] output) {
    +    public static void testB64toB512(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC64, BSPEC512, input, output);
         }
     
    @@ -71,7 +72,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "2"})
    -    public static void testB128toB64(byte[] input, byte[] output) {
    +    public static void testB128toB64(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC128, BSPEC64, input, output);
         }
     
    @@ -82,7 +83,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(failOn = REINTERPRET_NODE)
    -    public static void testB128toB256(byte[] input, byte[] output) {
    +    public static void testB128toB256(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC128, BSPEC256, input, output);
         }
     
    @@ -93,7 +94,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(failOn = REINTERPRET_NODE)
    -    public static void testB128toB512(byte[] input, byte[] output) {
    +    public static void testB128toB512(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC128, BSPEC512, input, output);
         }
     
    @@ -104,7 +105,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "2"})
    -    public static void testB256toB64(byte[] input, byte[] output) {
    +    public static void testB256toB64(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC256, BSPEC64, input, output);
         }
     
    @@ -115,7 +116,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "2"})
    -    public static void testB256toB128(byte[] input, byte[] output) {
    +    public static void testB256toB128(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC256, BSPEC128, input, output);
         }
     
    @@ -126,7 +127,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(failOn = REINTERPRET_NODE)
    -    public static void testB256toB512(byte[] input, byte[] output) {
    +    public static void testB256toB512(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC256, BSPEC512, input, output);
         }
     
    @@ -137,7 +138,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "2"})
    -    public static void testB512toB64(byte[] input, byte[] output) {
    +    public static void testB512toB64(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC512, BSPEC64, input, output);
         }
     
    @@ -148,7 +149,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "2"})
    -    public static void testB512toB128(byte[] input, byte[] output) {
    +    public static void testB512toB128(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC512, BSPEC128, input, output);
         }
     
    @@ -159,7 +160,7 @@ public class TestVectorDoubleExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "2"})
    -    public static void testB512toB256(byte[] input, byte[] output) {
    +    public static void testB512toB256(MemorySegment input, MemorySegment output) {
             vectorDoubleExpandShrink(BSPEC512, BSPEC256, input, output);
         }
     
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/tests/TestVectorExpandShrink.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/tests/TestVectorExpandShrink.java
    index f975331cef0..bd3a8f6c12d 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/tests/TestVectorExpandShrink.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/tests/TestVectorExpandShrink.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -26,6 +26,7 @@ package compiler.vectorapi.reshape.tests;
     import compiler.lib.ir_framework.IR;
     import compiler.lib.ir_framework.Run;
     import compiler.lib.ir_framework.Test;
    +import java.lang.foreign.MemorySegment;
     
     import static compiler.vectorapi.reshape.utils.VectorReshapeHelper.*;
     
    @@ -38,7 +39,7 @@ import static compiler.vectorapi.reshape.utils.VectorReshapeHelper.*;
     public class TestVectorExpandShrink {
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB64toB128(byte[] input, byte[] output) {
    +    public static void testB64toB128(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC64, BSPEC128, input, output);
         }
     
    @@ -49,7 +50,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB64toB256(byte[] input, byte[] output) {
    +    public static void testB64toB256(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC64, BSPEC256, input, output);
         }
     
    @@ -60,7 +61,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB64toB512(byte[] input, byte[] output) {
    +    public static void testB64toB512(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC64, BSPEC512, input, output);
         }
     
    @@ -71,7 +72,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB128toB64(byte[] input, byte[] output) {
    +    public static void testB128toB64(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC128, BSPEC64, input, output);
         }
     
    @@ -82,7 +83,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB128toB256(byte[] input, byte[] output) {
    +    public static void testB128toB256(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC128, BSPEC256, input, output);
         }
     
    @@ -93,7 +94,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB128toB512(byte[] input, byte[] output) {
    +    public static void testB128toB512(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC128, BSPEC512, input, output);
         }
     
    @@ -104,7 +105,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB256toB64(byte[] input, byte[] output) {
    +    public static void testB256toB64(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC256, BSPEC64, input, output);
         }
     
    @@ -115,7 +116,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB256toB128(byte[] input, byte[] output) {
    +    public static void testB256toB128(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC256, BSPEC128, input, output);
         }
     
    @@ -126,7 +127,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB256toB512(byte[] input, byte[] output) {
    +    public static void testB256toB512(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC256, BSPEC512, input, output);
         }
     
    @@ -137,7 +138,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB512toB64(byte[] input, byte[] output) {
    +    public static void testB512toB64(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC512, BSPEC64, input, output);
         }
     
    @@ -148,7 +149,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB512toB128(byte[] input, byte[] output) {
    +    public static void testB512toB128(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC512, BSPEC128, input, output);
         }
     
    @@ -159,7 +160,7 @@ public class TestVectorExpandShrink {
     
         @Test
         @IR(counts = {REINTERPRET_NODE, "1"})
    -    public static void testB512toB256(byte[] input, byte[] output) {
    +    public static void testB512toB256(MemorySegment input, MemorySegment output) {
             vectorExpandShrink(BSPEC512, BSPEC256, input, output);
         }
     
    diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/VectorReshapeHelper.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/VectorReshapeHelper.java
    index 6cfd934bb27..0349ae01871 100644
    --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/VectorReshapeHelper.java
    +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/VectorReshapeHelper.java
    @@ -35,6 +35,7 @@ import java.util.List;
     import java.util.random.RandomGenerator;
     import java.util.stream.Collectors;
     import java.util.stream.Stream;
    +import java.lang.foreign.MemorySegment;
     import jdk.incubator.vector.*;
     import jdk.test.lib.Asserts;
     import jdk.test.lib.Utils;
    @@ -85,7 +86,7 @@ public class VectorReshapeHelper {
             var test = new TestFramework(testClass);
             test.setDefaultWarmup(1);
             test.addHelperClasses(VectorReshapeHelper.class);
    -        test.addFlags("--add-modules=jdk.incubator.vector", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
    +        test.addFlags("--add-modules=jdk.incubator.vector", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "--enable-preview");
             test.addFlags(flags);
             String testMethodNames = testMethods
                     .filter(p -> p.isp().length() <= VectorSpecies.ofLargestShape(p.isp().elementType()).length())
    @@ -213,10 +214,11 @@ public class VectorReshapeHelper {
         }
     
         @ForceInline
    -    public static void vectorExpandShrink(VectorSpecies isp, VectorSpecies osp, byte[] input, byte[] output) {
    -        isp.fromByteArray(input, 0, ByteOrder.nativeOrder())
    +    public static void vectorExpandShrink(VectorSpecies isp, VectorSpecies osp,
    +                                          MemorySegment input, MemorySegment output) {
    +        isp.fromMemorySegment(input, 0, ByteOrder.nativeOrder())
                     .reinterpretShape(osp, 0)
    -                .intoByteArray(output, 0, ByteOrder.nativeOrder());
    +                .intoMemorySegment(output, 0, ByteOrder.nativeOrder());
         }
     
         public static void runExpandShrinkHelper(VectorSpecies isp, VectorSpecies osp) throws Throwable {
    @@ -225,13 +227,15 @@ public class VectorReshapeHelper {
             var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
             var testMethod = MethodHandles.lookup().findStatic(caller,
                     testMethodName,
    -                MethodType.methodType(void.class, byte.class.arrayType(), byte.class.arrayType()));
    +                MethodType.methodType(void.class, MemorySegment.class, MemorySegment.class));
             byte[] input = new byte[isp.vectorByteSize()];
             byte[] output = new byte[osp.vectorByteSize()];
    +        MemorySegment msInput = MemorySegment.ofArray(input);
    +        MemorySegment msOutput = MemorySegment.ofArray(output);
             for (int iter = 0; iter < INVOCATIONS; iter++) {
                 random.nextBytes(input);
     
    -            testMethod.invokeExact(input, output);
    +            testMethod.invokeExact(msInput, msOutput);
     
                 for (int i = 0; i < osp.vectorByteSize(); i++) {
                     int expected = i < isp.vectorByteSize() ? input[i] : 0;
    @@ -242,11 +246,12 @@ public class VectorReshapeHelper {
         }
     
         @ForceInline
    -    public static void vectorDoubleExpandShrink(VectorSpecies isp, VectorSpecies osp, byte[] input, byte[] output) {
    -        isp.fromByteArray(input, 0, ByteOrder.nativeOrder())
    +    public static void vectorDoubleExpandShrink(VectorSpecies isp, VectorSpecies osp,
    +                                                MemorySegment input, MemorySegment output) {
    +        isp.fromMemorySegment(input, 0, ByteOrder.nativeOrder())
                     .reinterpretShape(osp, 0)
                     .reinterpretShape(isp, 0)
    -                .intoByteArray(output, 0, ByteOrder.nativeOrder());
    +                .intoMemorySegment(output, 0, ByteOrder.nativeOrder());
         }
     
         public static void runDoubleExpandShrinkHelper(VectorSpecies isp, VectorSpecies osp) throws Throwable {
    @@ -255,13 +260,15 @@ public class VectorReshapeHelper {
             var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
             var testMethod = MethodHandles.lookup().findStatic(caller,
                     testMethodName,
    -                MethodType.methodType(void.class, byte.class.arrayType(), byte.class.arrayType()));
    +                MethodType.methodType(void.class, MemorySegment.class, MemorySegment.class));
             byte[] input = new byte[isp.vectorByteSize()];
             byte[] output = new byte[isp.vectorByteSize()];
    +        MemorySegment msInput = MemorySegment.ofArray(input);
    +        MemorySegment msOutput = MemorySegment.ofArray(output);
             for (int iter = 0; iter < INVOCATIONS; iter++) {
                 random.nextBytes(input);
     
    -            testMethod.invokeExact(input, output);
    +            testMethod.invokeExact(msInput, msOutput);
     
                 for (int i = 0; i < isp.vectorByteSize(); i++) {
                     int expected = i < osp.vectorByteSize() ? input[i] : 0;
    diff --git a/test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java b/test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java
    index 49e3a428c30..ddc8becbc01 100644
    --- a/test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java
    +++ b/test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java
    @@ -25,8 +25,8 @@
     * @test
     * @summary Test vectorization of popcount for Long
     * @requires vm.compiler2.enabled
    -* @requires vm.cpu.features ~= ".*avx512bw.*"
    -* @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64"
    +* @requires vm.cpu.features ~= ".*avx512bw.*" | vm.cpu.features ~= ".*sve.*"
    +* @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
     * @library /test/lib /
     * @run driver compiler.vectorization.TestPopCountVectorLong
     */
    @@ -57,7 +57,7 @@ public class TestPopCountVectorLong {
     
         @Test // needs to be run in (fast) debug mode
         @Warmup(10000)
    -    @IR(counts = {"PopCountVL", ">= 1"}) // Atleast one PopCountVL node is generated if vectorization is successful
    +    @IR(counts = {"PopCountVL", ">= 1"}) // At least one PopCountVL node is generated if vectorization is successful
         public void vectorizeBitCount() {
             for (int i = 0; i < LEN; ++i) {
                 output[i] = Long.bitCount(input[i]);
    diff --git a/test/jdk/jdk/incubator/vector/AbstractVectorLoadStoreTest.java b/test/jdk/jdk/incubator/vector/AbstractVectorLoadStoreTest.java
    index 7a9cbcafe3e..a664f65092b 100644
    --- a/test/jdk/jdk/incubator/vector/AbstractVectorLoadStoreTest.java
    +++ b/test/jdk/jdk/incubator/vector/AbstractVectorLoadStoreTest.java
    @@ -50,4 +50,16 @@ public class AbstractVectorLoadStoreTest extends AbstractVectorTest {
                             .order(ByteOrder.nativeOrder());
                 })
         );
    +
    +    static final List> MEMORY_SEGMENT_GENERATORS = List.of(
    +            withToString("HMS", (int s) -> {
    +                return MemorySegment.allocateNative(s, MemorySession.openImplicit());
    +            }),
    +            withToString("DMS", (int s) -> {
    +                byte[] b = new byte[s];
    +                return MemorySegment.ofArray(b);
    +            })
    +    );
    +
     }
    +
    diff --git a/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java
    index 6328c1bd456..930c8ce791e 100644
    --- a/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ByteVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,9 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -53,6 +54,8 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfByte ELEMENT_LAYOUT = ValueLayout.JAVA_BYTE.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
     
    @@ -67,7 +70,6 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
         static final List> BYTE_GENERATORS = List.of(
                 withToString("byte[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -107,7 +109,7 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -178,9 +180,9 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferProvider() {
    +    public Object[][] byteMemorySegmentProvider() {
             return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -188,35 +190,16 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferMaskProvider() {
    +    public Object[][] byteMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> BYTE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] byteByteArrayProvider() {
    -        return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] byteByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> BYTE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] byteByteProviderForIOOBE() {
             var f = BYTE_GENERATORS.get(0);
    @@ -236,28 +219,16 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(byte[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (byte v : a) {
    -            bb.put(v);
    +    static MemorySegment toSegment(byte[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static byte[] bufferToArray(ByteBuffer bb) {
    -        ByteBuffer db = bb;
    -        byte[] d = new byte[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(byte[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ByteBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo);
    -        for (byte v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static byte[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -297,46 +268,25 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "byteProvider")
         static void loadStoreArray(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -507,48 +457,45 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -560,25 +507,25 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -589,70 +536,61 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "byteByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "byteMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             byte[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -664,27 +602,27 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -695,214 +633,36 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "byteByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "byteByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -917,6 +677,7 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java
    index 74530578167..cc0e780e0c3 100644
    --- a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java
    @@ -261,6 +261,55 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (byte)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (byte)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(byte[] r, byte[] a, byte[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -894,7 +943,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static byte bits(byte e) {
             return  e;
         }
    @@ -989,8 +1037,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1066,7 +1112,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> BYTE_COMPARE_GENERATORS = List.of(
                 withToString("byte[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1207,6 +1252,21 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
         }
     
    +    static byte TRAILING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a != 0 ? Integer.numberOfTrailingZeros(a) : 8);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 24 : 0);
    +    }
    +
    +    static byte REVERSE_scalar(byte a) {
    +        byte b = (byte) ROL_scalar(a, (byte) 4);
    +        b = (byte) (((b & 0x55) << 1) | ((b & 0xAA) >>> 1));
    +        b = (byte) (((b & 0x33) << 2) | ((b & 0xCC) >>> 2));
    +        return b;
    +    }
    +
         static boolean eq(byte a, byte b) {
             return a == b;
         }
    @@ -1356,6 +1416,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static byte ADD(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1376,6 +1437,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte128VectorTests::ADD);
         }
    +
         static byte add(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1432,6 +1494,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::add);
         }
    +
         static byte SUB(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1452,6 +1515,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte128VectorTests::SUB);
         }
    +
         static byte sub(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1508,6 +1572,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::sub);
         }
    +
         static byte MUL(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1528,6 +1593,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte128VectorTests::MUL);
         }
    +
         static byte mul(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1585,8 +1651,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::mul);
         }
     
    -
    -
         static byte DIV(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1609,6 +1673,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte128VectorTests::DIV);
         }
    +
         static byte div(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1632,8 +1697,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void DIVByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1739,6 +1802,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte128VectorTests::AND);
         }
    +
         static byte and(byte a, byte b) {
             return (byte)(a & b);
         }
    @@ -1758,8 +1822,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1780,7 +1842,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::AND);
         }
     
    -
         static byte AND_NOT(byte a, byte b) {
             return (byte)(a & ~b);
         }
    @@ -1802,8 +1863,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void AND_NOTByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1824,7 +1883,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::AND_NOT);
         }
     
    -
         static byte OR(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1845,6 +1903,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte128VectorTests::OR);
         }
    +
         static byte or(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1864,8 +1923,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1886,7 +1943,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::OR);
         }
     
    -
         static byte XOR(byte a, byte b) {
             return (byte)(a ^ b);
         }
    @@ -1908,8 +1964,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void XORByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1930,7 +1984,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void addByte128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2024,9 +2077,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void divByte128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2043,8 +2093,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void divByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2064,8 +2112,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByte128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2094,8 +2140,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2113,8 +2157,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ANDByte128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2143,8 +2185,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2162,8 +2202,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByte128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2178,8 +2216,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Byte128VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte128VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2197,7 +2233,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Byte128VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ADDByte128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2229,8 +2264,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Byte128VectorTests::ADD);
         }
     
    -
    -
         static byte LSHL(byte a, byte b) {
             return (byte)((a << (b & 0x7)));
         }
    @@ -2252,8 +2285,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2274,11 +2305,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR(byte a, byte b) {
             return (byte)((a >> (b & 0x7)));
         }
    @@ -2300,8 +2326,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2322,11 +2346,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 0x7)));
         }
    @@ -2348,8 +2367,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2370,11 +2387,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHL_unary(byte a, byte b) {
             return (byte)((a << (b & 7)));
         }
    @@ -2395,8 +2407,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte128VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByte128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2416,11 +2426,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR_unary(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 7)));
         }
    @@ -2441,8 +2446,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte128VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByte128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2462,11 +2465,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR_unary(byte a, byte b) {
             return (byte)((a >> (b & 7)));
         }
    @@ -2487,8 +2485,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte128VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByte128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2508,9 +2504,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::ASHR_unary);
         }
     
    -
    -
    -
         static byte ROR(byte a, byte b) {
             return (byte)(ROR_scalar(a,b));
         }
    @@ -2532,8 +2525,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2554,7 +2545,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::ROR);
         }
     
    -
         static byte ROL(byte a, byte b) {
             return (byte)(ROL_scalar(a,b));
         }
    @@ -2576,8 +2566,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte128VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2598,7 +2586,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte128VectorTests::ROL);
         }
     
    -
         static byte ROR_unary(byte a, byte b) {
             return (byte)(ROR_scalar(a, b));
         }
    @@ -2619,8 +2606,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte128VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByte128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2640,7 +2625,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::ROR_unary);
         }
     
    -
         static byte ROL_unary(byte a, byte b) {
             return (byte)(ROL_scalar(a, b));
         }
    @@ -2661,8 +2645,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte128VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByte128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2681,10 +2663,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::ROL_unary);
         }
    -
    -
    -
    -
         static byte LSHR_binary_const(byte a) {
             return (byte)(((a & 0xFF) >>> CONST_SHIFT));
         }
    @@ -2704,8 +2682,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte128VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHRByte128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2724,10 +2700,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte128VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
         static byte LSHL_binary_const(byte a) {
             return (byte)((a << CONST_SHIFT));
         }
    @@ -2747,8 +2719,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte128VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHLByte128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2767,8 +2737,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte128VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static byte ASHR_binary_const(byte a) {
             return (byte)((a >> CONST_SHIFT));
         }
    @@ -2788,8 +2756,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte128VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ASHRByte128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2808,8 +2774,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte128VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static byte ROR_binary_const(byte a) {
             return (byte)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2829,8 +2793,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte128VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void RORByte128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2849,8 +2811,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte128VectorTests::ROR_binary_const);
         }
     
    -
    -
         static byte ROL_binary_const(byte a) {
             return (byte)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2870,8 +2830,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte128VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ROLByte128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2911,6 +2869,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte128VectorTests::MIN);
         }
    +
         static byte min(byte a, byte b) {
             return (byte)(Math.min(a, b));
         }
    @@ -2929,6 +2888,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte128VectorTests::min);
         }
    +
         static byte MAX(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -2949,6 +2909,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte128VectorTests::MAX);
         }
    +
         static byte max(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -3042,7 +3003,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ANDReduceByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3068,7 +3028,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
                     Byte128VectorTests::ANDReduce, Byte128VectorTests::ANDReduceAll);
         }
     
    -
         static byte ANDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3088,7 +3047,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ANDReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3116,7 +3074,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
                     Byte128VectorTests::ANDReduceMasked, Byte128VectorTests::ANDReduceAllMasked);
         }
     
    -
         static byte ORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3135,7 +3092,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ORReduceByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3161,7 +3117,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
                     Byte128VectorTests::ORReduce, Byte128VectorTests::ORReduceAll);
         }
     
    -
         static byte ORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3181,7 +3136,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ORReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3209,7 +3163,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
                     Byte128VectorTests::ORReduceMasked, Byte128VectorTests::ORReduceAllMasked);
         }
     
    -
         static byte XORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3228,7 +3181,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void XORReduceByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3254,7 +3206,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
                     Byte128VectorTests::XORReduce, Byte128VectorTests::XORReduceAll);
         }
     
    -
         static byte XORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3274,7 +3225,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void XORReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3319,6 +3269,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ADDReduceByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3343,6 +3294,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte128VectorTests::ADDReduce, Byte128VectorTests::ADDReduceAll);
         }
    +
         static byte ADDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3361,6 +3313,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ADDReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3387,6 +3340,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte128VectorTests::ADDReduceMasked, Byte128VectorTests::ADDReduceAllMasked);
         }
    +
         static byte MULReduce(byte[] a, int idx) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3404,6 +3358,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MULReduceByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3428,6 +3383,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte128VectorTests::MULReduce, Byte128VectorTests::MULReduceAll);
         }
    +
         static byte MULReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3446,6 +3402,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MULReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3472,6 +3429,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte128VectorTests::MULReduceMasked, Byte128VectorTests::MULReduceAllMasked);
         }
    +
         static byte MINReduce(byte[] a, int idx) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3489,6 +3447,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MINReduceByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3513,6 +3472,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte128VectorTests::MINReduce, Byte128VectorTests::MINReduceAll);
         }
    +
         static byte MINReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3531,6 +3491,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MINReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3557,6 +3518,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte128VectorTests::MINReduceMasked, Byte128VectorTests::MINReduceAllMasked);
         }
    +
         static byte MAXReduce(byte[] a, int idx) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3574,6 +3536,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MAXReduceByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3598,6 +3561,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte128VectorTests::MAXReduce, Byte128VectorTests::MAXReduceAll);
         }
    +
         static byte MAXReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3616,6 +3580,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MAXReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3642,6 +3607,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte128VectorTests::MAXReduceMasked, Byte128VectorTests::MAXReduceAllMasked);
         }
    +
         static byte FIRST_NONZEROReduce(byte[] a, int idx) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3659,6 +3625,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void FIRST_NONZEROReduceByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3683,6 +3650,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte128VectorTests::FIRST_NONZEROReduce, Byte128VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static byte FIRST_NONZEROReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3701,6 +3669,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3737,7 +3706,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueByte128VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3753,7 +3721,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Byte128VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3763,7 +3730,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueByte128VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3779,7 +3745,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Byte128VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void withByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3797,6 +3762,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(byte a) {
             return bits(a)==0;
         }
    @@ -3837,6 +3803,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(byte a) {
             return bits(a)<0;
         }
    @@ -3878,9 +3845,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3900,7 +3864,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3943,7 +3906,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GTByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3986,7 +3948,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void EQByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4006,7 +3967,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void eqByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4049,7 +4009,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void NEByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4092,7 +4051,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LEByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4135,7 +4093,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GEByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4178,8 +4135,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LTByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4199,8 +4154,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LTByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4224,9 +4177,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GTByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4246,8 +4196,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GTByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4271,9 +4219,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LEByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4293,8 +4238,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LEByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4318,9 +4261,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GEByte128VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4340,8 +4280,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GEByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4365,8 +4303,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByte128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4383,7 +4319,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4420,7 +4355,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByte128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4457,7 +4391,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4494,7 +4427,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByte128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4573,6 +4505,43 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void compressByte128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void expandByte128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void getByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4743,10 +4712,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZeroByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4761,9 +4726,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static byte[] sliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4789,6 +4751,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Byte128VectorTests::sliceUnary);
         }
    +
         static byte[] sliceBinary(byte[] a, byte[] b, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4818,6 +4781,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Byte128VectorTests::sliceBinary);
         }
    +
         static byte[] slice(byte[] a, byte[] b, int origin, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4851,6 +4815,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Byte128VectorTests::slice);
         }
    +
         static byte[] unsliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4878,6 +4843,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Byte128VectorTests::unsliceUnary);
         }
    +
         static byte[] unsliceBinary(byte[] a, byte[] b, int origin, int part, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4917,6 +4883,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Byte128VectorTests::unsliceBinary);
         }
    +
         static byte[] unslice(byte[] a, byte[] b, int origin, int part, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4974,36 +4941,14 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Byte128VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static byte BITWISE_BLEND(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
    +
         static byte bitwiseBlend(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5022,6 +4967,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Byte128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5039,7 +4985,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Byte128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5062,9 +5007,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Byte128VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5094,6 +5036,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5124,7 +5067,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5163,9 +5105,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Byte128VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5180,6 +5119,7 @@ public class Byte128VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5195,7 +5135,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte128VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5214,7 +5153,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Byte128VectorTests::BITWISE_BLEND);
         }
     
    -
         static byte NEG(byte a) {
             return (byte)(-((byte)a));
         }
    @@ -5327,7 +5265,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte128VectorTests::ABS);
         }
     
    -
         static byte NOT(byte a) {
             return (byte)(~((byte)a));
         }
    @@ -5336,8 +5273,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             return (byte)(~((byte)a));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void NOTByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5368,8 +5303,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Byte128VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void NOTMaskedByte128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5388,14 +5321,10 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte128VectorTests::NOT);
         }
     
    -
    -
         static byte ZOMO(byte a) {
             return (byte)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZOMOByte128VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5411,8 +5340,6 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Byte128VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ZOMOMaskedByte128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5431,9 +5358,190 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte128VectorTests::ZOMO);
         }
     
    +    static byte BIT_COUNT(byte a) {
    +        return (byte)(Integer.bitCount((int)a & 0xFF));
    +    }
     
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void BIT_COUNTByte128VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Byte128VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedByte128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte128VectorTests::BIT_COUNT);
    +    }
    +
    +    static byte TRAILING_ZEROS_COUNT(byte a) {
    +        return (byte)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTByte128VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte128VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedByte128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte128VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT(byte a) {
    +        return (byte)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTByte128VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte128VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedByte128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte128VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static byte REVERSE(byte a) {
    +        return (byte)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSEByte128VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte128VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSEMaskedByte128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte128VectorTests::REVERSE);
    +    }
    +
    +    static byte REVERSE_BYTES(byte a) {
    +        return (byte)(a);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSE_BYTESByte128VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte128VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedByte128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte128VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByte128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5847,6 +5955,23 @@ public class Byte128VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Byte128VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressByte128VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5889,6 +6014,20 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongByte128VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5909,6 +6048,14 @@ public class Byte128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongByte128VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeByte128VectorTestsSmokeTest() {
             ByteVector av = ByteVector.zero(SPECIES);
    @@ -5971,4 +6118,3 @@ public class Byte128VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java
    index d83df806260..0c52ddde4f3 100644
    --- a/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ByteVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,9 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -53,6 +54,8 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfByte ELEMENT_LAYOUT = ValueLayout.JAVA_BYTE.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
     
    @@ -67,7 +70,6 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
         static final List> BYTE_GENERATORS = List.of(
                 withToString("byte[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -107,7 +109,7 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -178,9 +180,9 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferProvider() {
    +    public Object[][] byteMemorySegmentProvider() {
             return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -188,35 +190,16 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferMaskProvider() {
    +    public Object[][] byteMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> BYTE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] byteByteArrayProvider() {
    -        return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] byteByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> BYTE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] byteByteProviderForIOOBE() {
             var f = BYTE_GENERATORS.get(0);
    @@ -236,28 +219,16 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(byte[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (byte v : a) {
    -            bb.put(v);
    +    static MemorySegment toSegment(byte[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static byte[] bufferToArray(ByteBuffer bb) {
    -        ByteBuffer db = bb;
    -        byte[] d = new byte[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(byte[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ByteBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo);
    -        for (byte v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static byte[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -297,46 +268,25 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "byteProvider")
         static void loadStoreArray(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -507,48 +457,45 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -560,25 +507,25 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -589,70 +536,61 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "byteByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "byteMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             byte[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -664,27 +602,27 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -695,214 +633,36 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "byteByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "byteByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -917,6 +677,7 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java
    index 2e2426f0df0..153ffe99d43 100644
    --- a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java
    @@ -261,6 +261,55 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (byte)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (byte)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(byte[] r, byte[] a, byte[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -894,7 +943,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static byte bits(byte e) {
             return  e;
         }
    @@ -989,8 +1037,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1066,7 +1112,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> BYTE_COMPARE_GENERATORS = List.of(
                 withToString("byte[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1207,6 +1252,21 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
         }
     
    +    static byte TRAILING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a != 0 ? Integer.numberOfTrailingZeros(a) : 8);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 24 : 0);
    +    }
    +
    +    static byte REVERSE_scalar(byte a) {
    +        byte b = (byte) ROL_scalar(a, (byte) 4);
    +        b = (byte) (((b & 0x55) << 1) | ((b & 0xAA) >>> 1));
    +        b = (byte) (((b & 0x33) << 2) | ((b & 0xCC) >>> 2));
    +        return b;
    +    }
    +
         static boolean eq(byte a, byte b) {
             return a == b;
         }
    @@ -1356,6 +1416,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static byte ADD(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1376,6 +1437,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte256VectorTests::ADD);
         }
    +
         static byte add(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1432,6 +1494,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::add);
         }
    +
         static byte SUB(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1452,6 +1515,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte256VectorTests::SUB);
         }
    +
         static byte sub(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1508,6 +1572,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::sub);
         }
    +
         static byte MUL(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1528,6 +1593,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte256VectorTests::MUL);
         }
    +
         static byte mul(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1585,8 +1651,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::mul);
         }
     
    -
    -
         static byte DIV(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1609,6 +1673,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte256VectorTests::DIV);
         }
    +
         static byte div(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1632,8 +1697,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void DIVByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1739,6 +1802,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte256VectorTests::AND);
         }
    +
         static byte and(byte a, byte b) {
             return (byte)(a & b);
         }
    @@ -1758,8 +1822,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1780,7 +1842,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::AND);
         }
     
    -
         static byte AND_NOT(byte a, byte b) {
             return (byte)(a & ~b);
         }
    @@ -1802,8 +1863,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void AND_NOTByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1824,7 +1883,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::AND_NOT);
         }
     
    -
         static byte OR(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1845,6 +1903,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte256VectorTests::OR);
         }
    +
         static byte or(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1864,8 +1923,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1886,7 +1943,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::OR);
         }
     
    -
         static byte XOR(byte a, byte b) {
             return (byte)(a ^ b);
         }
    @@ -1908,8 +1964,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void XORByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1930,7 +1984,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void addByte256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2024,9 +2077,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte256VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void divByte256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2043,8 +2093,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void divByte256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2064,8 +2112,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByte256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2094,8 +2140,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte256VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2113,8 +2157,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte256VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ANDByte256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2143,8 +2185,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte256VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByte256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2162,8 +2202,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte256VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByte256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2178,8 +2216,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Byte256VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte256VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2197,7 +2233,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Byte256VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ADDByte256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2229,8 +2264,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Byte256VectorTests::ADD);
         }
     
    -
    -
         static byte LSHL(byte a, byte b) {
             return (byte)((a << (b & 0x7)));
         }
    @@ -2252,8 +2285,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2274,11 +2305,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR(byte a, byte b) {
             return (byte)((a >> (b & 0x7)));
         }
    @@ -2300,8 +2326,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2322,11 +2346,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 0x7)));
         }
    @@ -2348,8 +2367,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2370,11 +2387,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHL_unary(byte a, byte b) {
             return (byte)((a << (b & 7)));
         }
    @@ -2395,8 +2407,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte256VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByte256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2416,11 +2426,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte256VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR_unary(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 7)));
         }
    @@ -2441,8 +2446,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte256VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByte256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2462,11 +2465,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte256VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR_unary(byte a, byte b) {
             return (byte)((a >> (b & 7)));
         }
    @@ -2487,8 +2485,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte256VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByte256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2508,9 +2504,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte256VectorTests::ASHR_unary);
         }
     
    -
    -
    -
         static byte ROR(byte a, byte b) {
             return (byte)(ROR_scalar(a,b));
         }
    @@ -2532,8 +2525,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2554,7 +2545,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::ROR);
         }
     
    -
         static byte ROL(byte a, byte b) {
             return (byte)(ROL_scalar(a,b));
         }
    @@ -2576,8 +2566,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte256VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2598,7 +2586,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte256VectorTests::ROL);
         }
     
    -
         static byte ROR_unary(byte a, byte b) {
             return (byte)(ROR_scalar(a, b));
         }
    @@ -2619,8 +2606,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte256VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByte256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2640,7 +2625,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte256VectorTests::ROR_unary);
         }
     
    -
         static byte ROL_unary(byte a, byte b) {
             return (byte)(ROL_scalar(a, b));
         }
    @@ -2661,8 +2645,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte256VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByte256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2681,10 +2663,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Byte256VectorTests::ROL_unary);
         }
    -
    -
    -
    -
         static byte LSHR_binary_const(byte a) {
             return (byte)(((a & 0xFF) >>> CONST_SHIFT));
         }
    @@ -2704,8 +2682,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte256VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHRByte256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2724,10 +2700,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte256VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
         static byte LSHL_binary_const(byte a) {
             return (byte)((a << CONST_SHIFT));
         }
    @@ -2747,8 +2719,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte256VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHLByte256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2767,8 +2737,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte256VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static byte ASHR_binary_const(byte a) {
             return (byte)((a >> CONST_SHIFT));
         }
    @@ -2788,8 +2756,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte256VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ASHRByte256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2808,8 +2774,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte256VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static byte ROR_binary_const(byte a) {
             return (byte)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2829,8 +2793,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte256VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void RORByte256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2849,8 +2811,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte256VectorTests::ROR_binary_const);
         }
     
    -
    -
         static byte ROL_binary_const(byte a) {
             return (byte)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2870,8 +2830,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte256VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ROLByte256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2911,6 +2869,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte256VectorTests::MIN);
         }
    +
         static byte min(byte a, byte b) {
             return (byte)(Math.min(a, b));
         }
    @@ -2929,6 +2888,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte256VectorTests::min);
         }
    +
         static byte MAX(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -2949,6 +2909,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte256VectorTests::MAX);
         }
    +
         static byte max(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -3042,7 +3003,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ANDReduceByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3068,7 +3028,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
                     Byte256VectorTests::ANDReduce, Byte256VectorTests::ANDReduceAll);
         }
     
    -
         static byte ANDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3088,7 +3047,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ANDReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3116,7 +3074,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
                     Byte256VectorTests::ANDReduceMasked, Byte256VectorTests::ANDReduceAllMasked);
         }
     
    -
         static byte ORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3135,7 +3092,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ORReduceByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3161,7 +3117,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
                     Byte256VectorTests::ORReduce, Byte256VectorTests::ORReduceAll);
         }
     
    -
         static byte ORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3181,7 +3136,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ORReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3209,7 +3163,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
                     Byte256VectorTests::ORReduceMasked, Byte256VectorTests::ORReduceAllMasked);
         }
     
    -
         static byte XORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3228,7 +3181,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void XORReduceByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3254,7 +3206,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
                     Byte256VectorTests::XORReduce, Byte256VectorTests::XORReduceAll);
         }
     
    -
         static byte XORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3274,7 +3225,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void XORReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3319,6 +3269,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ADDReduceByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3343,6 +3294,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte256VectorTests::ADDReduce, Byte256VectorTests::ADDReduceAll);
         }
    +
         static byte ADDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3361,6 +3313,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ADDReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3387,6 +3340,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte256VectorTests::ADDReduceMasked, Byte256VectorTests::ADDReduceAllMasked);
         }
    +
         static byte MULReduce(byte[] a, int idx) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3404,6 +3358,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MULReduceByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3428,6 +3383,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte256VectorTests::MULReduce, Byte256VectorTests::MULReduceAll);
         }
    +
         static byte MULReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3446,6 +3402,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MULReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3472,6 +3429,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte256VectorTests::MULReduceMasked, Byte256VectorTests::MULReduceAllMasked);
         }
    +
         static byte MINReduce(byte[] a, int idx) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3489,6 +3447,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MINReduceByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3513,6 +3472,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte256VectorTests::MINReduce, Byte256VectorTests::MINReduceAll);
         }
    +
         static byte MINReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3531,6 +3491,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MINReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3557,6 +3518,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte256VectorTests::MINReduceMasked, Byte256VectorTests::MINReduceAllMasked);
         }
    +
         static byte MAXReduce(byte[] a, int idx) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3574,6 +3536,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MAXReduceByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3598,6 +3561,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte256VectorTests::MAXReduce, Byte256VectorTests::MAXReduceAll);
         }
    +
         static byte MAXReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3616,6 +3580,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MAXReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3642,6 +3607,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte256VectorTests::MAXReduceMasked, Byte256VectorTests::MAXReduceAllMasked);
         }
    +
         static byte FIRST_NONZEROReduce(byte[] a, int idx) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3659,6 +3625,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void FIRST_NONZEROReduceByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3683,6 +3650,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte256VectorTests::FIRST_NONZEROReduce, Byte256VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static byte FIRST_NONZEROReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3701,6 +3669,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3737,7 +3706,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueByte256VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3753,7 +3721,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Byte256VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3763,7 +3730,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueByte256VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3779,7 +3745,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Byte256VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void withByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3797,6 +3762,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(byte a) {
             return bits(a)==0;
         }
    @@ -3837,6 +3803,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(byte a) {
             return bits(a)<0;
         }
    @@ -3878,9 +3845,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3900,7 +3864,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3943,7 +3906,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GTByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3986,7 +3948,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void EQByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4006,7 +3967,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void eqByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4049,7 +4009,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void NEByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4092,7 +4051,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LEByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4135,7 +4093,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GEByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4178,8 +4135,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LTByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4199,8 +4154,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LTByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4224,9 +4177,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GTByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4246,8 +4196,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GTByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4271,9 +4219,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LEByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4293,8 +4238,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LEByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4318,9 +4261,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GEByte256VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4340,8 +4280,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GEByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4365,8 +4303,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByte256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4383,7 +4319,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByte256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4420,7 +4355,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByte256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4457,7 +4391,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByte256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4494,7 +4427,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByte256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4573,6 +4505,43 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void compressByte256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void expandByte256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void getByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4743,10 +4712,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZeroByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4761,9 +4726,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static byte[] sliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4789,6 +4751,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Byte256VectorTests::sliceUnary);
         }
    +
         static byte[] sliceBinary(byte[] a, byte[] b, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4818,6 +4781,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Byte256VectorTests::sliceBinary);
         }
    +
         static byte[] slice(byte[] a, byte[] b, int origin, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4851,6 +4815,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Byte256VectorTests::slice);
         }
    +
         static byte[] unsliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4878,6 +4843,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Byte256VectorTests::unsliceUnary);
         }
    +
         static byte[] unsliceBinary(byte[] a, byte[] b, int origin, int part, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4917,6 +4883,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Byte256VectorTests::unsliceBinary);
         }
    +
         static byte[] unslice(byte[] a, byte[] b, int origin, int part, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4974,36 +4941,14 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Byte256VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static byte BITWISE_BLEND(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
    +
         static byte bitwiseBlend(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5022,6 +4967,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Byte256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5039,7 +4985,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Byte256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5062,9 +5007,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Byte256VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5094,6 +5036,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Byte256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5124,7 +5067,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Byte256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5163,9 +5105,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Byte256VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5180,6 +5119,7 @@ public class Byte256VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Byte256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5195,7 +5135,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Byte256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte256VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5214,7 +5153,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Byte256VectorTests::BITWISE_BLEND);
         }
     
    -
         static byte NEG(byte a) {
             return (byte)(-((byte)a));
         }
    @@ -5327,7 +5265,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte256VectorTests::ABS);
         }
     
    -
         static byte NOT(byte a) {
             return (byte)(~((byte)a));
         }
    @@ -5336,8 +5273,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             return (byte)(~((byte)a));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void NOTByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5368,8 +5303,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Byte256VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void NOTMaskedByte256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5388,14 +5321,10 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte256VectorTests::NOT);
         }
     
    -
    -
         static byte ZOMO(byte a) {
             return (byte)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZOMOByte256VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5411,8 +5340,6 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Byte256VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ZOMOMaskedByte256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5431,9 +5358,190 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte256VectorTests::ZOMO);
         }
     
    +    static byte BIT_COUNT(byte a) {
    +        return (byte)(Integer.bitCount((int)a & 0xFF));
    +    }
     
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void BIT_COUNTByte256VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Byte256VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedByte256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte256VectorTests::BIT_COUNT);
    +    }
    +
    +    static byte TRAILING_ZEROS_COUNT(byte a) {
    +        return (byte)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTByte256VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte256VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedByte256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte256VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT(byte a) {
    +        return (byte)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTByte256VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte256VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedByte256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte256VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static byte REVERSE(byte a) {
    +        return (byte)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSEByte256VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte256VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSEMaskedByte256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte256VectorTests::REVERSE);
    +    }
    +
    +    static byte REVERSE_BYTES(byte a) {
    +        return (byte)(a);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSE_BYTESByte256VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte256VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedByte256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte256VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByte256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5847,6 +5955,23 @@ public class Byte256VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Byte256VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressByte256VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5889,6 +6014,20 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongByte256VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5909,6 +6048,14 @@ public class Byte256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongByte256VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeByte256VectorTestsSmokeTest() {
             ByteVector av = ByteVector.zero(SPECIES);
    @@ -5971,4 +6118,3 @@ public class Byte256VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java
    index 53fddd14dbc..c9990cdf2ce 100644
    --- a/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ByteVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,9 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -53,6 +54,8 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfByte ELEMENT_LAYOUT = ValueLayout.JAVA_BYTE.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
     
    @@ -67,7 +70,6 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
         static final List> BYTE_GENERATORS = List.of(
                 withToString("byte[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -107,7 +109,7 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -178,9 +180,9 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferProvider() {
    +    public Object[][] byteMemorySegmentProvider() {
             return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -188,35 +190,16 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferMaskProvider() {
    +    public Object[][] byteMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> BYTE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] byteByteArrayProvider() {
    -        return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] byteByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> BYTE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] byteByteProviderForIOOBE() {
             var f = BYTE_GENERATORS.get(0);
    @@ -236,28 +219,16 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(byte[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (byte v : a) {
    -            bb.put(v);
    +    static MemorySegment toSegment(byte[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static byte[] bufferToArray(ByteBuffer bb) {
    -        ByteBuffer db = bb;
    -        byte[] d = new byte[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(byte[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ByteBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo);
    -        for (byte v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static byte[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -297,46 +268,25 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "byteProvider")
         static void loadStoreArray(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -507,48 +457,45 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -560,25 +507,25 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -589,70 +536,61 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "byteByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "byteMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             byte[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -664,27 +602,27 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -695,214 +633,36 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "byteByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "byteByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -917,6 +677,7 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java
    index 897e87ae7fb..35ad368f632 100644
    --- a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java
    @@ -261,6 +261,55 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (byte)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (byte)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(byte[] r, byte[] a, byte[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -894,7 +943,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static byte bits(byte e) {
             return  e;
         }
    @@ -989,8 +1037,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1066,7 +1112,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> BYTE_COMPARE_GENERATORS = List.of(
                 withToString("byte[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1207,6 +1252,21 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
         }
     
    +    static byte TRAILING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a != 0 ? Integer.numberOfTrailingZeros(a) : 8);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 24 : 0);
    +    }
    +
    +    static byte REVERSE_scalar(byte a) {
    +        byte b = (byte) ROL_scalar(a, (byte) 4);
    +        b = (byte) (((b & 0x55) << 1) | ((b & 0xAA) >>> 1));
    +        b = (byte) (((b & 0x33) << 2) | ((b & 0xCC) >>> 2));
    +        return b;
    +    }
    +
         static boolean eq(byte a, byte b) {
             return a == b;
         }
    @@ -1356,6 +1416,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static byte ADD(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1376,6 +1437,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte512VectorTests::ADD);
         }
    +
         static byte add(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1432,6 +1494,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::add);
         }
    +
         static byte SUB(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1452,6 +1515,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte512VectorTests::SUB);
         }
    +
         static byte sub(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1508,6 +1572,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::sub);
         }
    +
         static byte MUL(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1528,6 +1593,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte512VectorTests::MUL);
         }
    +
         static byte mul(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1585,8 +1651,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::mul);
         }
     
    -
    -
         static byte DIV(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1609,6 +1673,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte512VectorTests::DIV);
         }
    +
         static byte div(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1632,8 +1697,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void DIVByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1739,6 +1802,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte512VectorTests::AND);
         }
    +
         static byte and(byte a, byte b) {
             return (byte)(a & b);
         }
    @@ -1758,8 +1822,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1780,7 +1842,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::AND);
         }
     
    -
         static byte AND_NOT(byte a, byte b) {
             return (byte)(a & ~b);
         }
    @@ -1802,8 +1863,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void AND_NOTByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1824,7 +1883,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::AND_NOT);
         }
     
    -
         static byte OR(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1845,6 +1903,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte512VectorTests::OR);
         }
    +
         static byte or(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1864,8 +1923,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1886,7 +1943,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::OR);
         }
     
    -
         static byte XOR(byte a, byte b) {
             return (byte)(a ^ b);
         }
    @@ -1908,8 +1964,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void XORByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1930,7 +1984,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void addByte512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2024,9 +2077,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte512VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void divByte512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2043,8 +2093,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void divByte512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2064,8 +2112,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByte512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2094,8 +2140,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte512VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2113,8 +2157,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte512VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ANDByte512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2143,8 +2185,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte512VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByte512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2162,8 +2202,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte512VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByte512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2178,8 +2216,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Byte512VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte512VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2197,7 +2233,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Byte512VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ADDByte512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2229,8 +2264,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Byte512VectorTests::ADD);
         }
     
    -
    -
         static byte LSHL(byte a, byte b) {
             return (byte)((a << (b & 0x7)));
         }
    @@ -2252,8 +2285,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2274,11 +2305,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR(byte a, byte b) {
             return (byte)((a >> (b & 0x7)));
         }
    @@ -2300,8 +2326,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2322,11 +2346,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 0x7)));
         }
    @@ -2348,8 +2367,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2370,11 +2387,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHL_unary(byte a, byte b) {
             return (byte)((a << (b & 7)));
         }
    @@ -2395,8 +2407,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte512VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByte512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2416,11 +2426,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte512VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR_unary(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 7)));
         }
    @@ -2441,8 +2446,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte512VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByte512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2462,11 +2465,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte512VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR_unary(byte a, byte b) {
             return (byte)((a >> (b & 7)));
         }
    @@ -2487,8 +2485,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte512VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByte512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2508,9 +2504,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte512VectorTests::ASHR_unary);
         }
     
    -
    -
    -
         static byte ROR(byte a, byte b) {
             return (byte)(ROR_scalar(a,b));
         }
    @@ -2532,8 +2525,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2554,7 +2545,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::ROR);
         }
     
    -
         static byte ROL(byte a, byte b) {
             return (byte)(ROL_scalar(a,b));
         }
    @@ -2576,8 +2566,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte512VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2598,7 +2586,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte512VectorTests::ROL);
         }
     
    -
         static byte ROR_unary(byte a, byte b) {
             return (byte)(ROR_scalar(a, b));
         }
    @@ -2619,8 +2606,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte512VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByte512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2640,7 +2625,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte512VectorTests::ROR_unary);
         }
     
    -
         static byte ROL_unary(byte a, byte b) {
             return (byte)(ROL_scalar(a, b));
         }
    @@ -2661,8 +2645,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte512VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByte512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2681,10 +2663,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Byte512VectorTests::ROL_unary);
         }
    -
    -
    -
    -
         static byte LSHR_binary_const(byte a) {
             return (byte)(((a & 0xFF) >>> CONST_SHIFT));
         }
    @@ -2704,8 +2682,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte512VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHRByte512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2724,10 +2700,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte512VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
         static byte LSHL_binary_const(byte a) {
             return (byte)((a << CONST_SHIFT));
         }
    @@ -2747,8 +2719,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte512VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHLByte512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2767,8 +2737,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte512VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static byte ASHR_binary_const(byte a) {
             return (byte)((a >> CONST_SHIFT));
         }
    @@ -2788,8 +2756,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte512VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ASHRByte512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2808,8 +2774,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte512VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static byte ROR_binary_const(byte a) {
             return (byte)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2829,8 +2793,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte512VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void RORByte512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2849,8 +2811,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte512VectorTests::ROR_binary_const);
         }
     
    -
    -
         static byte ROL_binary_const(byte a) {
             return (byte)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2870,8 +2830,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte512VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ROLByte512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2911,6 +2869,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte512VectorTests::MIN);
         }
    +
         static byte min(byte a, byte b) {
             return (byte)(Math.min(a, b));
         }
    @@ -2929,6 +2888,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte512VectorTests::min);
         }
    +
         static byte MAX(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -2949,6 +2909,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte512VectorTests::MAX);
         }
    +
         static byte max(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -3042,7 +3003,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ANDReduceByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3068,7 +3028,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
                     Byte512VectorTests::ANDReduce, Byte512VectorTests::ANDReduceAll);
         }
     
    -
         static byte ANDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3088,7 +3047,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ANDReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3116,7 +3074,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
                     Byte512VectorTests::ANDReduceMasked, Byte512VectorTests::ANDReduceAllMasked);
         }
     
    -
         static byte ORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3135,7 +3092,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ORReduceByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3161,7 +3117,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
                     Byte512VectorTests::ORReduce, Byte512VectorTests::ORReduceAll);
         }
     
    -
         static byte ORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3181,7 +3136,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ORReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3209,7 +3163,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
                     Byte512VectorTests::ORReduceMasked, Byte512VectorTests::ORReduceAllMasked);
         }
     
    -
         static byte XORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3228,7 +3181,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void XORReduceByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3254,7 +3206,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
                     Byte512VectorTests::XORReduce, Byte512VectorTests::XORReduceAll);
         }
     
    -
         static byte XORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3274,7 +3225,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void XORReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3319,6 +3269,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ADDReduceByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3343,6 +3294,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte512VectorTests::ADDReduce, Byte512VectorTests::ADDReduceAll);
         }
    +
         static byte ADDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3361,6 +3313,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ADDReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3387,6 +3340,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte512VectorTests::ADDReduceMasked, Byte512VectorTests::ADDReduceAllMasked);
         }
    +
         static byte MULReduce(byte[] a, int idx) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3404,6 +3358,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MULReduceByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3428,6 +3383,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte512VectorTests::MULReduce, Byte512VectorTests::MULReduceAll);
         }
    +
         static byte MULReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3446,6 +3402,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MULReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3472,6 +3429,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte512VectorTests::MULReduceMasked, Byte512VectorTests::MULReduceAllMasked);
         }
    +
         static byte MINReduce(byte[] a, int idx) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3489,6 +3447,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MINReduceByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3513,6 +3472,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte512VectorTests::MINReduce, Byte512VectorTests::MINReduceAll);
         }
    +
         static byte MINReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3531,6 +3491,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MINReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3557,6 +3518,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte512VectorTests::MINReduceMasked, Byte512VectorTests::MINReduceAllMasked);
         }
    +
         static byte MAXReduce(byte[] a, int idx) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3574,6 +3536,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MAXReduceByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3598,6 +3561,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte512VectorTests::MAXReduce, Byte512VectorTests::MAXReduceAll);
         }
    +
         static byte MAXReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3616,6 +3580,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MAXReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3642,6 +3607,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte512VectorTests::MAXReduceMasked, Byte512VectorTests::MAXReduceAllMasked);
         }
    +
         static byte FIRST_NONZEROReduce(byte[] a, int idx) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3659,6 +3625,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void FIRST_NONZEROReduceByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3683,6 +3650,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte512VectorTests::FIRST_NONZEROReduce, Byte512VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static byte FIRST_NONZEROReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3701,6 +3669,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3737,7 +3706,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueByte512VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3753,7 +3721,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Byte512VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3763,7 +3730,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueByte512VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3779,7 +3745,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Byte512VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void withByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3797,6 +3762,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(byte a) {
             return bits(a)==0;
         }
    @@ -3837,6 +3803,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(byte a) {
             return bits(a)<0;
         }
    @@ -3878,9 +3845,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3900,7 +3864,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3943,7 +3906,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GTByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3986,7 +3948,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void EQByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4006,7 +3967,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void eqByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4049,7 +4009,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void NEByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4092,7 +4051,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LEByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4135,7 +4093,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GEByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4178,8 +4135,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LTByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4199,8 +4154,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LTByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4224,9 +4177,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GTByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4246,8 +4196,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GTByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4271,9 +4219,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LEByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4293,8 +4238,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LEByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4318,9 +4261,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GEByte512VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4340,8 +4280,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GEByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4365,8 +4303,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByte512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4383,7 +4319,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByte512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4420,7 +4355,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByte512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4457,7 +4391,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByte512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4494,7 +4427,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByte512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4573,6 +4505,43 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void compressByte512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void expandByte512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void getByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4743,10 +4712,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZeroByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4761,9 +4726,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static byte[] sliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4789,6 +4751,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Byte512VectorTests::sliceUnary);
         }
    +
         static byte[] sliceBinary(byte[] a, byte[] b, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4818,6 +4781,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Byte512VectorTests::sliceBinary);
         }
    +
         static byte[] slice(byte[] a, byte[] b, int origin, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4851,6 +4815,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Byte512VectorTests::slice);
         }
    +
         static byte[] unsliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4878,6 +4843,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Byte512VectorTests::unsliceUnary);
         }
    +
         static byte[] unsliceBinary(byte[] a, byte[] b, int origin, int part, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4917,6 +4883,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Byte512VectorTests::unsliceBinary);
         }
    +
         static byte[] unslice(byte[] a, byte[] b, int origin, int part, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4974,36 +4941,14 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Byte512VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static byte BITWISE_BLEND(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
    +
         static byte bitwiseBlend(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5022,6 +4967,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Byte512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5039,7 +4985,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Byte512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5062,9 +5007,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Byte512VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5094,6 +5036,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Byte512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5124,7 +5067,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Byte512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5163,9 +5105,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Byte512VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5180,6 +5119,7 @@ public class Byte512VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Byte512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5195,7 +5135,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Byte512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte512VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5214,7 +5153,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Byte512VectorTests::BITWISE_BLEND);
         }
     
    -
         static byte NEG(byte a) {
             return (byte)(-((byte)a));
         }
    @@ -5327,7 +5265,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte512VectorTests::ABS);
         }
     
    -
         static byte NOT(byte a) {
             return (byte)(~((byte)a));
         }
    @@ -5336,8 +5273,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             return (byte)(~((byte)a));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void NOTByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5368,8 +5303,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Byte512VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void NOTMaskedByte512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5388,14 +5321,10 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte512VectorTests::NOT);
         }
     
    -
    -
         static byte ZOMO(byte a) {
             return (byte)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZOMOByte512VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5411,8 +5340,6 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Byte512VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ZOMOMaskedByte512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5431,9 +5358,190 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte512VectorTests::ZOMO);
         }
     
    +    static byte BIT_COUNT(byte a) {
    +        return (byte)(Integer.bitCount((int)a & 0xFF));
    +    }
     
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void BIT_COUNTByte512VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Byte512VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedByte512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte512VectorTests::BIT_COUNT);
    +    }
    +
    +    static byte TRAILING_ZEROS_COUNT(byte a) {
    +        return (byte)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTByte512VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte512VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedByte512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte512VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT(byte a) {
    +        return (byte)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTByte512VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte512VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedByte512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte512VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static byte REVERSE(byte a) {
    +        return (byte)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSEByte512VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte512VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSEMaskedByte512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte512VectorTests::REVERSE);
    +    }
    +
    +    static byte REVERSE_BYTES(byte a) {
    +        return (byte)(a);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSE_BYTESByte512VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte512VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedByte512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte512VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByte512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5847,6 +5955,23 @@ public class Byte512VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Byte512VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressByte512VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5889,6 +6014,20 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongByte512VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5909,6 +6048,14 @@ public class Byte512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongByte512VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeByte512VectorTestsSmokeTest() {
             ByteVector av = ByteVector.zero(SPECIES);
    @@ -5971,4 +6118,3 @@ public class Byte512VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java
    index 049c353e8f5..10312b7cb5f 100644
    --- a/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ByteVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,9 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -53,6 +54,8 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfByte ELEMENT_LAYOUT = ValueLayout.JAVA_BYTE.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
     
    @@ -67,7 +70,6 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
         static final List> BYTE_GENERATORS = List.of(
                 withToString("byte[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -107,7 +109,7 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -178,9 +180,9 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferProvider() {
    +    public Object[][] byteMemorySegmentProvider() {
             return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -188,35 +190,16 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferMaskProvider() {
    +    public Object[][] byteMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> BYTE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] byteByteArrayProvider() {
    -        return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] byteByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> BYTE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] byteByteProviderForIOOBE() {
             var f = BYTE_GENERATORS.get(0);
    @@ -236,28 +219,16 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(byte[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (byte v : a) {
    -            bb.put(v);
    +    static MemorySegment toSegment(byte[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static byte[] bufferToArray(ByteBuffer bb) {
    -        ByteBuffer db = bb;
    -        byte[] d = new byte[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(byte[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ByteBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo);
    -        for (byte v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static byte[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -297,46 +268,25 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "byteProvider")
         static void loadStoreArray(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -507,48 +457,45 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -560,25 +507,25 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -589,70 +536,61 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "byteByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "byteMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             byte[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -664,27 +602,27 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -695,214 +633,36 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "byteByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "byteByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -917,6 +677,7 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java
    index 025fc68b428..f931780f779 100644
    --- a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java
    @@ -261,6 +261,55 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (byte)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (byte)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(byte[] r, byte[] a, byte[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -894,7 +943,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static byte bits(byte e) {
             return  e;
         }
    @@ -989,8 +1037,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1066,7 +1112,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> BYTE_COMPARE_GENERATORS = List.of(
                 withToString("byte[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1207,6 +1252,21 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
         }
     
    +    static byte TRAILING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a != 0 ? Integer.numberOfTrailingZeros(a) : 8);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 24 : 0);
    +    }
    +
    +    static byte REVERSE_scalar(byte a) {
    +        byte b = (byte) ROL_scalar(a, (byte) 4);
    +        b = (byte) (((b & 0x55) << 1) | ((b & 0xAA) >>> 1));
    +        b = (byte) (((b & 0x33) << 2) | ((b & 0xCC) >>> 2));
    +        return b;
    +    }
    +
         static boolean eq(byte a, byte b) {
             return a == b;
         }
    @@ -1356,6 +1416,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static byte ADD(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1376,6 +1437,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte64VectorTests::ADD);
         }
    +
         static byte add(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1432,6 +1494,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::add);
         }
    +
         static byte SUB(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1452,6 +1515,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte64VectorTests::SUB);
         }
    +
         static byte sub(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1508,6 +1572,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::sub);
         }
    +
         static byte MUL(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1528,6 +1593,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte64VectorTests::MUL);
         }
    +
         static byte mul(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1585,8 +1651,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::mul);
         }
     
    -
    -
         static byte DIV(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1609,6 +1673,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte64VectorTests::DIV);
         }
    +
         static byte div(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1632,8 +1697,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void DIVByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1739,6 +1802,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte64VectorTests::AND);
         }
    +
         static byte and(byte a, byte b) {
             return (byte)(a & b);
         }
    @@ -1758,8 +1822,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1780,7 +1842,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::AND);
         }
     
    -
         static byte AND_NOT(byte a, byte b) {
             return (byte)(a & ~b);
         }
    @@ -1802,8 +1863,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void AND_NOTByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1824,7 +1883,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::AND_NOT);
         }
     
    -
         static byte OR(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1845,6 +1903,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte64VectorTests::OR);
         }
    +
         static byte or(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1864,8 +1923,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1886,7 +1943,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::OR);
         }
     
    -
         static byte XOR(byte a, byte b) {
             return (byte)(a ^ b);
         }
    @@ -1908,8 +1964,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void XORByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1930,7 +1984,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void addByte64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2024,9 +2077,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte64VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void divByte64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2043,8 +2093,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void divByte64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2064,8 +2112,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByte64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2094,8 +2140,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte64VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2113,8 +2157,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte64VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ANDByte64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2143,8 +2185,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Byte64VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByte64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2162,8 +2202,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Byte64VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByte64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2178,8 +2216,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Byte64VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByte64VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2197,7 +2233,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Byte64VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ADDByte64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2229,8 +2264,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Byte64VectorTests::ADD);
         }
     
    -
    -
         static byte LSHL(byte a, byte b) {
             return (byte)((a << (b & 0x7)));
         }
    @@ -2252,8 +2285,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2274,11 +2305,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR(byte a, byte b) {
             return (byte)((a >> (b & 0x7)));
         }
    @@ -2300,8 +2326,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2322,11 +2346,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 0x7)));
         }
    @@ -2348,8 +2367,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2370,11 +2387,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHL_unary(byte a, byte b) {
             return (byte)((a << (b & 7)));
         }
    @@ -2395,8 +2407,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte64VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByte64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2416,11 +2426,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte64VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR_unary(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 7)));
         }
    @@ -2441,8 +2446,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte64VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByte64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2462,11 +2465,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte64VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR_unary(byte a, byte b) {
             return (byte)((a >> (b & 7)));
         }
    @@ -2487,8 +2485,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte64VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByte64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2508,9 +2504,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte64VectorTests::ASHR_unary);
         }
     
    -
    -
    -
         static byte ROR(byte a, byte b) {
             return (byte)(ROR_scalar(a,b));
         }
    @@ -2532,8 +2525,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2554,7 +2545,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::ROR);
         }
     
    -
         static byte ROL(byte a, byte b) {
             return (byte)(ROL_scalar(a,b));
         }
    @@ -2576,8 +2566,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Byte64VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2598,7 +2586,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Byte64VectorTests::ROL);
         }
     
    -
         static byte ROR_unary(byte a, byte b) {
             return (byte)(ROR_scalar(a, b));
         }
    @@ -2619,8 +2606,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte64VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByte64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2640,7 +2625,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Byte64VectorTests::ROR_unary);
         }
     
    -
         static byte ROL_unary(byte a, byte b) {
             return (byte)(ROL_scalar(a, b));
         }
    @@ -2661,8 +2645,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Byte64VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByte64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2681,10 +2663,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Byte64VectorTests::ROL_unary);
         }
    -
    -
    -
    -
         static byte LSHR_binary_const(byte a) {
             return (byte)(((a & 0xFF) >>> CONST_SHIFT));
         }
    @@ -2704,8 +2682,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte64VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHRByte64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2724,10 +2700,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte64VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
         static byte LSHL_binary_const(byte a) {
             return (byte)((a << CONST_SHIFT));
         }
    @@ -2747,8 +2719,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte64VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHLByte64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2767,8 +2737,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte64VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static byte ASHR_binary_const(byte a) {
             return (byte)((a >> CONST_SHIFT));
         }
    @@ -2788,8 +2756,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte64VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ASHRByte64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2808,8 +2774,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte64VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static byte ROR_binary_const(byte a) {
             return (byte)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2829,8 +2793,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte64VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void RORByte64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2849,8 +2811,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Byte64VectorTests::ROR_binary_const);
         }
     
    -
    -
         static byte ROL_binary_const(byte a) {
             return (byte)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2870,8 +2830,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Byte64VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ROLByte64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2911,6 +2869,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte64VectorTests::MIN);
         }
    +
         static byte min(byte a, byte b) {
             return (byte)(Math.min(a, b));
         }
    @@ -2929,6 +2888,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte64VectorTests::min);
         }
    +
         static byte MAX(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -2949,6 +2909,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Byte64VectorTests::MAX);
         }
    +
         static byte max(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -3042,7 +3003,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ANDReduceByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3068,7 +3028,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
                     Byte64VectorTests::ANDReduce, Byte64VectorTests::ANDReduceAll);
         }
     
    -
         static byte ANDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3088,7 +3047,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ANDReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3116,7 +3074,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
                     Byte64VectorTests::ANDReduceMasked, Byte64VectorTests::ANDReduceAllMasked);
         }
     
    -
         static byte ORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3135,7 +3092,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ORReduceByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3161,7 +3117,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
                     Byte64VectorTests::ORReduce, Byte64VectorTests::ORReduceAll);
         }
     
    -
         static byte ORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3181,7 +3136,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ORReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3209,7 +3163,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
                     Byte64VectorTests::ORReduceMasked, Byte64VectorTests::ORReduceAllMasked);
         }
     
    -
         static byte XORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3228,7 +3181,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void XORReduceByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3254,7 +3206,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
                     Byte64VectorTests::XORReduce, Byte64VectorTests::XORReduceAll);
         }
     
    -
         static byte XORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3274,7 +3225,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void XORReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3319,6 +3269,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ADDReduceByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3343,6 +3294,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte64VectorTests::ADDReduce, Byte64VectorTests::ADDReduceAll);
         }
    +
         static byte ADDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3361,6 +3313,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ADDReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3387,6 +3340,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte64VectorTests::ADDReduceMasked, Byte64VectorTests::ADDReduceAllMasked);
         }
    +
         static byte MULReduce(byte[] a, int idx) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3404,6 +3358,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MULReduceByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3428,6 +3383,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte64VectorTests::MULReduce, Byte64VectorTests::MULReduceAll);
         }
    +
         static byte MULReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3446,6 +3402,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MULReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3472,6 +3429,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte64VectorTests::MULReduceMasked, Byte64VectorTests::MULReduceAllMasked);
         }
    +
         static byte MINReduce(byte[] a, int idx) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3489,6 +3447,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MINReduceByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3513,6 +3472,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte64VectorTests::MINReduce, Byte64VectorTests::MINReduceAll);
         }
    +
         static byte MINReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3531,6 +3491,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MINReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3557,6 +3518,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte64VectorTests::MINReduceMasked, Byte64VectorTests::MINReduceAllMasked);
         }
    +
         static byte MAXReduce(byte[] a, int idx) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3574,6 +3536,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MAXReduceByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3598,6 +3561,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte64VectorTests::MAXReduce, Byte64VectorTests::MAXReduceAll);
         }
    +
         static byte MAXReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3616,6 +3580,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MAXReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3642,6 +3607,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Byte64VectorTests::MAXReduceMasked, Byte64VectorTests::MAXReduceAllMasked);
         }
    +
         static byte FIRST_NONZEROReduce(byte[] a, int idx) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3659,6 +3625,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void FIRST_NONZEROReduceByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3683,6 +3650,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Byte64VectorTests::FIRST_NONZEROReduce, Byte64VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static byte FIRST_NONZEROReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3701,6 +3669,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3737,7 +3706,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueByte64VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3753,7 +3721,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Byte64VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3763,7 +3730,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueByte64VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3779,7 +3745,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Byte64VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void withByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3797,6 +3762,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(byte a) {
             return bits(a)==0;
         }
    @@ -3837,6 +3803,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(byte a) {
             return bits(a)<0;
         }
    @@ -3878,9 +3845,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3900,7 +3864,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3943,7 +3906,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GTByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3986,7 +3948,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void EQByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4006,7 +3967,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void eqByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4049,7 +4009,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void NEByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4092,7 +4051,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LEByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4135,7 +4093,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GEByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4178,8 +4135,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LTByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4199,8 +4154,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LTByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4224,9 +4177,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GTByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4246,8 +4196,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GTByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4271,9 +4219,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LEByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4293,8 +4238,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LEByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4318,9 +4261,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GEByte64VectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4340,8 +4280,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GEByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4365,8 +4303,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByte64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4383,7 +4319,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByte64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4420,7 +4355,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByte64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4457,7 +4391,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByte64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4494,7 +4427,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByte64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4573,6 +4505,43 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void compressByte64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void expandByte64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void getByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4743,10 +4712,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZeroByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4761,9 +4726,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static byte[] sliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4789,6 +4751,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Byte64VectorTests::sliceUnary);
         }
    +
         static byte[] sliceBinary(byte[] a, byte[] b, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4818,6 +4781,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Byte64VectorTests::sliceBinary);
         }
    +
         static byte[] slice(byte[] a, byte[] b, int origin, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4851,6 +4815,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Byte64VectorTests::slice);
         }
    +
         static byte[] unsliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4878,6 +4843,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Byte64VectorTests::unsliceUnary);
         }
    +
         static byte[] unsliceBinary(byte[] a, byte[] b, int origin, int part, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4917,6 +4883,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Byte64VectorTests::unsliceBinary);
         }
    +
         static byte[] unslice(byte[] a, byte[] b, int origin, int part, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4974,36 +4941,14 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Byte64VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static byte BITWISE_BLEND(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
    +
         static byte bitwiseBlend(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5022,6 +4967,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Byte64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5039,7 +4985,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Byte64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5062,9 +5007,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Byte64VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5094,6 +5036,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Byte64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5124,7 +5067,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Byte64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5163,9 +5105,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Byte64VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByte64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5180,6 +5119,7 @@ public class Byte64VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Byte64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByte64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5195,7 +5135,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Byte64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByte64VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5214,7 +5153,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Byte64VectorTests::BITWISE_BLEND);
         }
     
    -
         static byte NEG(byte a) {
             return (byte)(-((byte)a));
         }
    @@ -5327,7 +5265,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte64VectorTests::ABS);
         }
     
    -
         static byte NOT(byte a) {
             return (byte)(~((byte)a));
         }
    @@ -5336,8 +5273,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             return (byte)(~((byte)a));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void NOTByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5368,8 +5303,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Byte64VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void NOTMaskedByte64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5388,14 +5321,10 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte64VectorTests::NOT);
         }
     
    -
    -
         static byte ZOMO(byte a) {
             return (byte)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZOMOByte64VectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5411,8 +5340,6 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Byte64VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ZOMOMaskedByte64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5431,9 +5358,190 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Byte64VectorTests::ZOMO);
         }
     
    +    static byte BIT_COUNT(byte a) {
    +        return (byte)(Integer.bitCount((int)a & 0xFF));
    +    }
     
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void BIT_COUNTByte64VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Byte64VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedByte64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte64VectorTests::BIT_COUNT);
    +    }
    +
    +    static byte TRAILING_ZEROS_COUNT(byte a) {
    +        return (byte)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTByte64VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte64VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedByte64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte64VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT(byte a) {
    +        return (byte)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTByte64VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte64VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedByte64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte64VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static byte REVERSE(byte a) {
    +        return (byte)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSEByte64VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte64VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSEMaskedByte64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte64VectorTests::REVERSE);
    +    }
    +
    +    static byte REVERSE_BYTES(byte a) {
    +        return (byte)(a);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSE_BYTESByte64VectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Byte64VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedByte64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Byte64VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByte64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5847,6 +5955,23 @@ public class Byte64VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Byte64VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressByte64VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5889,6 +6014,20 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongByte64VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5909,6 +6048,14 @@ public class Byte64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongByte64VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeByte64VectorTestsSmokeTest() {
             ByteVector av = ByteVector.zero(SPECIES);
    @@ -5971,4 +6118,3 @@ public class Byte64VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java
    index 9a88f9144a4..a9042cb65f9 100644
    --- a/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java
    @@ -32,6 +32,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ByteVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorShape;
    @@ -42,11 +45,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.lang.invoke.MethodHandles;
    -import java.lang.invoke.VarHandle;
    -import java.nio.ByteBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -57,6 +56,8 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfByte ELEMENT_LAYOUT = ValueLayout.JAVA_BYTE.withBitAlignment(8);
    +
         static VectorShape getMaxBit() {
             return VectorShape.S_Max_BIT;
         }
    @@ -76,7 +77,6 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
         static final List> BYTE_GENERATORS = List.of(
                 withToString("byte[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -116,7 +116,7 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -187,9 +187,9 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferProvider() {
    +    public Object[][] byteMemorySegmentProvider() {
             return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -197,35 +197,16 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] byteByteBufferMaskProvider() {
    +    public Object[][] byteMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> BYTE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] byteByteArrayProvider() {
    -        return BYTE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] byteByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> BYTE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] byteByteProviderForIOOBE() {
             var f = BYTE_GENERATORS.get(0);
    @@ -245,28 +226,16 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(byte[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (byte v : a) {
    -            bb.put(v);
    +    static MemorySegment toSegment(byte[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static byte[] bufferToArray(ByteBuffer bb) {
    -        ByteBuffer db = bb;
    -        byte[] d = new byte[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(byte[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ByteBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo);
    -        for (byte v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static byte[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -306,46 +275,25 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ByteVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ByteVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ByteVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ByteVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ByteVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ByteVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ByteVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ByteVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "byteProvider")
         static void loadStoreArray(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -516,48 +464,45 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -569,25 +514,25 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -598,70 +543,61 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "byteByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "byteMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             byte[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ByteVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -673,27 +609,27 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Byte.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Byte.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ByteVector av = ByteVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ByteVector av = ByteVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -704,214 +640,36 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "byteMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "byteByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "byteByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "byteByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "byteByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ByteVector av = ByteVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ByteVector av = ByteVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -926,6 +684,7 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java
    index abbb45361b1..1fc848239f4 100644
    --- a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java
    @@ -266,6 +266,55 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (byte)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (byte)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(byte[] r, byte[] a, byte[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -899,7 +948,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static byte bits(byte e) {
             return  e;
         }
    @@ -994,8 +1042,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1071,7 +1117,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> BYTE_COMPARE_GENERATORS = List.of(
                 withToString("byte[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1212,6 +1257,21 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
         }
     
    +    static byte TRAILING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a != 0 ? Integer.numberOfTrailingZeros(a) : 8);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT_scalar(byte a) {
    +        return (byte) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 24 : 0);
    +    }
    +
    +    static byte REVERSE_scalar(byte a) {
    +        byte b = (byte) ROL_scalar(a, (byte) 4);
    +        b = (byte) (((b & 0x55) << 1) | ((b & 0xAA) >>> 1));
    +        b = (byte) (((b & 0x33) << 2) | ((b & 0xCC) >>> 2));
    +        return b;
    +    }
    +
         static boolean eq(byte a, byte b) {
             return a == b;
         }
    @@ -1361,6 +1421,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static byte ADD(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1381,6 +1442,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ByteMaxVectorTests::ADD);
         }
    +
         static byte add(byte a, byte b) {
             return (byte)(a + b);
         }
    @@ -1437,6 +1499,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::add);
         }
    +
         static byte SUB(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1457,6 +1520,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ByteMaxVectorTests::SUB);
         }
    +
         static byte sub(byte a, byte b) {
             return (byte)(a - b);
         }
    @@ -1513,6 +1577,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::sub);
         }
    +
         static byte MUL(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1533,6 +1598,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ByteMaxVectorTests::MUL);
         }
    +
         static byte mul(byte a, byte b) {
             return (byte)(a * b);
         }
    @@ -1590,8 +1656,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::mul);
         }
     
    -
    -
         static byte DIV(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1614,6 +1678,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ByteMaxVectorTests::DIV);
         }
    +
         static byte div(byte a, byte b) {
             return (byte)(a / b);
         }
    @@ -1637,8 +1702,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void DIVByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1744,6 +1807,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ByteMaxVectorTests::AND);
         }
    +
         static byte and(byte a, byte b) {
             return (byte)(a & b);
         }
    @@ -1763,8 +1827,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1785,7 +1847,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::AND);
         }
     
    -
         static byte AND_NOT(byte a, byte b) {
             return (byte)(a & ~b);
         }
    @@ -1807,8 +1868,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void AND_NOTByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1829,7 +1888,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::AND_NOT);
         }
     
    -
         static byte OR(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1850,6 +1908,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ByteMaxVectorTests::OR);
         }
    +
         static byte or(byte a, byte b) {
             return (byte)(a | b);
         }
    @@ -1869,8 +1928,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1891,7 +1948,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::OR);
         }
     
    -
         static byte XOR(byte a, byte b) {
             return (byte)(a ^ b);
         }
    @@ -1913,8 +1969,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void XORByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1935,7 +1989,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void addByteMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2029,9 +2082,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, ByteMaxVectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void divByteMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2048,8 +2098,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, ByteMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void divByteMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2069,8 +2117,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, ByteMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByteMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2099,8 +2145,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, ByteMaxVectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByteMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2118,8 +2162,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, ByteMaxVectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ANDByteMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2148,8 +2190,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, ByteMaxVectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ANDByteMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2167,8 +2207,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, ByteMaxVectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ORByteMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2183,8 +2221,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, ByteMaxVectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ORByteMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2202,7 +2238,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, ByteMaxVectorTests::OR);
         }
     
    -
         @Test(dataProvider = "byteBinaryOpProvider")
         static void ADDByteMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -2234,8 +2269,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, ByteMaxVectorTests::ADD);
         }
     
    -
    -
         static byte LSHL(byte a, byte b) {
             return (byte)((a << (b & 0x7)));
         }
    @@ -2257,8 +2290,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2279,11 +2310,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR(byte a, byte b) {
             return (byte)((a >> (b & 0x7)));
         }
    @@ -2305,8 +2331,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2327,11 +2351,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 0x7)));
         }
    @@ -2353,8 +2372,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2375,11 +2392,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static byte LSHL_unary(byte a, byte b) {
             return (byte)((a << (b & 7)));
         }
    @@ -2400,8 +2412,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ByteMaxVectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHLByteMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2421,11 +2431,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, ByteMaxVectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static byte LSHR_unary(byte a, byte b) {
             return (byte)(((a & 0xFF) >>> (b & 7)));
         }
    @@ -2446,8 +2451,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ByteMaxVectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void LSHRByteMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2467,11 +2470,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, ByteMaxVectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static byte ASHR_unary(byte a, byte b) {
             return (byte)((a >> (b & 7)));
         }
    @@ -2492,8 +2490,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ByteMaxVectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ASHRByteMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2513,9 +2509,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, ByteMaxVectorTests::ASHR_unary);
         }
     
    -
    -
    -
         static byte ROR(byte a, byte b) {
             return (byte)(ROR_scalar(a,b));
         }
    @@ -2537,8 +2530,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2559,7 +2550,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::ROR);
         }
     
    -
         static byte ROL(byte a, byte b) {
             return (byte)(ROL_scalar(a,b));
         }
    @@ -2581,8 +2571,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ByteMaxVectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2603,7 +2591,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ByteMaxVectorTests::ROL);
         }
     
    -
         static byte ROR_unary(byte a, byte b) {
             return (byte)(ROR_scalar(a, b));
         }
    @@ -2624,8 +2611,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ByteMaxVectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void RORByteMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2645,7 +2630,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, ByteMaxVectorTests::ROR_unary);
         }
     
    -
         static byte ROL_unary(byte a, byte b) {
             return (byte)(ROL_scalar(a, b));
         }
    @@ -2666,8 +2650,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ByteMaxVectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "byteBinaryOpMaskProvider")
         static void ROLByteMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2686,10 +2668,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, ByteMaxVectorTests::ROL_unary);
         }
    -
    -
    -
    -
         static byte LSHR_binary_const(byte a) {
             return (byte)(((a & 0xFF) >>> CONST_SHIFT));
         }
    @@ -2709,8 +2687,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ByteMaxVectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHRByteMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2729,10 +2705,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, ByteMaxVectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
         static byte LSHL_binary_const(byte a) {
             return (byte)((a << CONST_SHIFT));
         }
    @@ -2752,8 +2724,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ByteMaxVectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void LSHLByteMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2772,8 +2742,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, ByteMaxVectorTests::LSHL_binary_const);
         }
     
    -
    -
         static byte ASHR_binary_const(byte a) {
             return (byte)((a >> CONST_SHIFT));
         }
    @@ -2793,8 +2761,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ByteMaxVectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ASHRByteMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2813,8 +2779,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, ByteMaxVectorTests::ASHR_binary_const);
         }
     
    -
    -
         static byte ROR_binary_const(byte a) {
             return (byte)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2834,8 +2798,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ByteMaxVectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void RORByteMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2854,8 +2816,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, ByteMaxVectorTests::ROR_binary_const);
         }
     
    -
    -
         static byte ROL_binary_const(byte a) {
             return (byte)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2875,8 +2835,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ByteMaxVectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ROLByteMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2916,6 +2874,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ByteMaxVectorTests::MIN);
         }
    +
         static byte min(byte a, byte b) {
             return (byte)(Math.min(a, b));
         }
    @@ -2934,6 +2893,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ByteMaxVectorTests::min);
         }
    +
         static byte MAX(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -2954,6 +2914,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ByteMaxVectorTests::MAX);
         }
    +
         static byte max(byte a, byte b) {
             return (byte)(Math.max(a, b));
         }
    @@ -3047,7 +3008,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ANDReduceByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3073,7 +3033,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
                     ByteMaxVectorTests::ANDReduce, ByteMaxVectorTests::ANDReduceAll);
         }
     
    -
         static byte ANDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3093,7 +3052,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ANDReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3121,7 +3079,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
                     ByteMaxVectorTests::ANDReduceMasked, ByteMaxVectorTests::ANDReduceAllMasked);
         }
     
    -
         static byte ORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3140,7 +3097,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ORReduceByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3166,7 +3122,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
                     ByteMaxVectorTests::ORReduce, ByteMaxVectorTests::ORReduceAll);
         }
     
    -
         static byte ORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3186,7 +3141,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ORReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3214,7 +3168,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
                     ByteMaxVectorTests::ORReduceMasked, ByteMaxVectorTests::ORReduceAllMasked);
         }
     
    -
         static byte XORReduce(byte[] a, int idx) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3233,7 +3186,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void XORReduceByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3259,7 +3211,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
                     ByteMaxVectorTests::XORReduce, ByteMaxVectorTests::XORReduceAll);
         }
     
    -
         static byte XORReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3279,7 +3230,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void XORReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3324,6 +3274,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ADDReduceByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3348,6 +3299,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ByteMaxVectorTests::ADDReduce, ByteMaxVectorTests::ADDReduceAll);
         }
    +
         static byte ADDReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3366,6 +3318,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ADDReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3392,6 +3345,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     ByteMaxVectorTests::ADDReduceMasked, ByteMaxVectorTests::ADDReduceAllMasked);
         }
    +
         static byte MULReduce(byte[] a, int idx) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3409,6 +3363,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MULReduceByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3433,6 +3388,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ByteMaxVectorTests::MULReduce, ByteMaxVectorTests::MULReduceAll);
         }
    +
         static byte MULReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3451,6 +3407,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MULReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3477,6 +3434,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     ByteMaxVectorTests::MULReduceMasked, ByteMaxVectorTests::MULReduceAllMasked);
         }
    +
         static byte MINReduce(byte[] a, int idx) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3494,6 +3452,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MINReduceByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3518,6 +3477,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ByteMaxVectorTests::MINReduce, ByteMaxVectorTests::MINReduceAll);
         }
    +
         static byte MINReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3536,6 +3496,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MINReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3562,6 +3523,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     ByteMaxVectorTests::MINReduceMasked, ByteMaxVectorTests::MINReduceAllMasked);
         }
    +
         static byte MAXReduce(byte[] a, int idx) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3579,6 +3541,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void MAXReduceByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3603,6 +3566,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ByteMaxVectorTests::MAXReduce, ByteMaxVectorTests::MAXReduceAll);
         }
    +
         static byte MAXReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = Byte.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3621,6 +3585,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void MAXReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3647,6 +3612,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     ByteMaxVectorTests::MAXReduceMasked, ByteMaxVectorTests::MAXReduceAllMasked);
         }
    +
         static byte FIRST_NONZEROReduce(byte[] a, int idx) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3664,6 +3630,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void FIRST_NONZEROReduceByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3688,6 +3655,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ByteMaxVectorTests::FIRST_NONZEROReduce, ByteMaxVectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static byte FIRST_NONZEROReduceMasked(byte[] a, int idx, boolean[] mask) {
             byte res = (byte) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3706,6 +3674,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3742,7 +3711,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueByteMaxVectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3758,7 +3726,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, ByteMaxVectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3768,7 +3735,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueByteMaxVectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3784,7 +3750,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, ByteMaxVectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void withByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3802,6 +3767,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (byte)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(byte a) {
             return bits(a)==0;
         }
    @@ -3842,6 +3808,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(byte a) {
             return bits(a)<0;
         }
    @@ -3883,9 +3850,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3905,7 +3869,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3948,7 +3911,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GTByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -3991,7 +3953,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void EQByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4011,7 +3972,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void eqByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4054,7 +4014,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void NEByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4097,7 +4056,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LEByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4140,7 +4098,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void GEByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4183,8 +4140,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LTByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4204,8 +4159,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LTByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4229,9 +4182,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GTByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4251,8 +4201,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GTByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4276,9 +4224,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_LEByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4298,8 +4243,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_LEByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4323,9 +4266,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void UNSIGNED_GEByteMaxVectorTests(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4345,8 +4285,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void UNSIGNED_GEByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4370,8 +4308,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "byteCompareOpProvider")
         static void LTByteMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4388,7 +4324,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByteMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4425,7 +4360,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void LTByteMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4462,7 +4396,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByteMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4499,7 +4432,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "byteCompareOpMaskProvider")
         static void EQByteMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4578,6 +4510,43 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void compressByteMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void expandByteMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "byteUnaryOpProvider")
         static void getByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4748,10 +4717,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZeroByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -4766,9 +4731,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static byte[] sliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4794,6 +4756,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, ByteMaxVectorTests::sliceUnary);
         }
    +
         static byte[] sliceBinary(byte[] a, byte[] b, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4823,6 +4786,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, ByteMaxVectorTests::sliceBinary);
         }
    +
         static byte[] slice(byte[] a, byte[] b, int origin, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4856,6 +4820,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, ByteMaxVectorTests::slice);
         }
    +
         static byte[] unsliceUnary(byte[] a, int origin, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4883,6 +4848,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, ByteMaxVectorTests::unsliceUnary);
         }
    +
         static byte[] unsliceBinary(byte[] a, byte[] b, int origin, int part, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4922,6 +4888,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, ByteMaxVectorTests::unsliceBinary);
         }
    +
         static byte[] unslice(byte[] a, byte[] b, int origin, int part, boolean[] mask, int idx) {
             byte[] res = new byte[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4979,36 +4946,14 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, ByteMaxVectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static byte BITWISE_BLEND(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
    +
         static byte bitwiseBlend(byte a, byte b, byte c) {
             return (byte)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByteMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5027,6 +4972,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, ByteMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByteMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5044,7 +4990,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, ByteMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByteMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5067,9 +5012,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, ByteMaxVectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByteMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5099,6 +5041,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, ByteMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByteMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5129,7 +5072,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, ByteMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByteMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5168,9 +5110,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, ByteMaxVectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "byteTernaryOpProvider")
         static void BITWISE_BLENDByteMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5185,6 +5124,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, ByteMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "byteTernaryOpProvider")
         static void bitwiseBlendByteMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5200,7 +5140,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, ByteMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "byteTernaryOpMaskProvider")
         static void BITWISE_BLENDByteMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5219,7 +5158,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, ByteMaxVectorTests::BITWISE_BLEND);
         }
     
    -
         static byte NEG(byte a) {
             return (byte)(-((byte)a));
         }
    @@ -5332,7 +5270,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, ByteMaxVectorTests::ABS);
         }
     
    -
         static byte NOT(byte a) {
             return (byte)(~((byte)a));
         }
    @@ -5341,8 +5278,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             return (byte)(~((byte)a));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void NOTByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5373,8 +5308,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, ByteMaxVectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void NOTMaskedByteMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5393,14 +5326,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, ByteMaxVectorTests::NOT);
         }
     
    -
    -
         static byte ZOMO(byte a) {
             return (byte)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpProvider")
         static void ZOMOByteMaxVectorTests(IntFunction fa) {
             byte[] a = fa.apply(SPECIES.length());
    @@ -5416,8 +5345,6 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, ByteMaxVectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "byteUnaryOpMaskProvider")
         static void ZOMOMaskedByteMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5436,9 +5363,190 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, ByteMaxVectorTests::ZOMO);
         }
     
    +    static byte BIT_COUNT(byte a) {
    +        return (byte)(Integer.bitCount((int)a & 0xFF));
    +    }
     
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void BIT_COUNTByteMaxVectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, ByteMaxVectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedByteMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ByteMaxVectorTests::BIT_COUNT);
    +    }
    +
    +    static byte TRAILING_ZEROS_COUNT(byte a) {
    +        return (byte)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTByteMaxVectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, ByteMaxVectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedByteMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ByteMaxVectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static byte LEADING_ZEROS_COUNT(byte a) {
    +        return (byte)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTByteMaxVectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, ByteMaxVectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedByteMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ByteMaxVectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static byte REVERSE(byte a) {
    +        return (byte)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSEByteMaxVectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, ByteMaxVectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSEMaskedByteMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ByteMaxVectorTests::REVERSE);
    +    }
    +
    +    static byte REVERSE_BYTES(byte a) {
    +        return (byte)(a);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpProvider")
    +    static void REVERSE_BYTESByteMaxVectorTests(IntFunction fa) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, ByteMaxVectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "byteUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedByteMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        byte[] a = fa.apply(SPECIES.length());
    +        byte[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ByteVector av = ByteVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ByteMaxVectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "byteCompareOpProvider")
         static void ltByteMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5852,6 +5960,23 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, ByteMaxVectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressByteMaxVectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
     
         @DataProvider
         public static Object[][] offsetProvider() {
    @@ -5878,6 +6003,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongByteMaxVectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5898,6 +6037,14 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongByteMaxVectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeByteMaxVectorTestsSmokeTest() {
             ByteVector av = ByteVector.zero(SPECIES);
    @@ -5960,4 +6107,3 @@ public class ByteMaxVectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java
    index 7358ed560e2..68dd22c966e 100644
    --- a/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.DoubleVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.DoubleBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfDouble ELEMENT_LAYOUT = ValueLayout.JAVA_DOUBLE.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
     
    @@ -68,17 +70,6 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> DOUBLE_GENERATORS = List.of(
                 withToString("double[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferProvider() {
    +    public Object[][] doubleMemorySegmentProvider() {
             return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferMaskProvider() {
    +    public Object[][] doubleMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] doubleByteArrayProvider() {
    -        return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] doubleByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] doubleByteProviderForIOOBE() {
             var f = DOUBLE_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(double[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (double v : a) {
    -            bb.putDouble(v);
    +    static MemorySegment toSegment(double[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static double[] bufferToArray(ByteBuffer bb) {
    -        DoubleBuffer db = bb.asDoubleBuffer();
    -        double[] d = new double[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(double[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        DoubleBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asDoubleBuffer();
    -        for (double v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static double[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "doubleProvider")
         static void loadStoreArray(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "doubleByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "doubleMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             double[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "doubleByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "doubleByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Double128VectorTests.java b/test/jdk/jdk/incubator/vector/Double128VectorTests.java
    index 4ac5d33396b..f892de62b3b 100644
    --- a/test/jdk/jdk/incubator/vector/Double128VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Double128VectorTests.java
    @@ -60,7 +60,6 @@ public class Double128VectorTests extends AbstractVectorTest {
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
     
    -    private static final double CONST_SHIFT = Double.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
     
    @@ -261,6 +260,55 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (double)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (double)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(double[] r, double[] a, double[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1013,8 +1061,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         static long bits(double e) {
             return  Double.doubleToLongBits(e);
         }
    @@ -1198,7 +1244,6 @@ public class Double128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> DOUBLE_COMPARE_GENERATORS = List.of(
                 withToString("double[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1319,7 +1364,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(double a, double b) {
             return a == b;
         }
    @@ -1344,7 +1388,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static double firstNonZero(double a, double b) {
             return Double.compare(a, (double) 0) != 0 ? a : b;
         }
    @@ -1461,6 +1504,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double128VectorTests::ADD);
         }
    +
         static double add(double a, double b) {
             return (double)(a + b);
         }
    @@ -1517,6 +1561,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Double128VectorTests::add);
         }
    +
         static double SUB(double a, double b) {
             return (double)(a - b);
         }
    @@ -1537,6 +1582,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double128VectorTests::SUB);
         }
    +
         static double sub(double a, double b) {
             return (double)(a - b);
         }
    @@ -1593,6 +1639,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Double128VectorTests::sub);
         }
    +
         static double MUL(double a, double b) {
             return (double)(a * b);
         }
    @@ -1613,6 +1660,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double128VectorTests::MUL);
         }
    +
         static double mul(double a, double b) {
             return (double)(a * b);
         }
    @@ -1690,6 +1738,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double128VectorTests::DIV);
         }
    +
         static double div(double a, double b) {
             return (double)(a / b);
         }
    @@ -1709,8 +1758,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Double128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void DIVDouble128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1749,8 +1796,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Double128VectorTests::div);
         }
     
    -
    -
         static double FIRST_NONZERO(double a, double b) {
             return (double)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1792,14 +1837,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Double128VectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void addDouble128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1893,7 +1930,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Double128VectorTests::mul);
         }
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void divDouble128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1908,8 +1944,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Double128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void divDouble128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1927,15 +1961,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Double128VectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void ADDDouble128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1967,63 +1992,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Double128VectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double MIN(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2044,6 +2012,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double128VectorTests::MIN);
         }
    +
         static double min(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2062,6 +2031,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double128VectorTests::min);
         }
    +
         static double MAX(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2082,6 +2052,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double128VectorTests::MAX);
         }
    +
         static double max(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2157,17 +2128,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Double128VectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double ADDReduce(double[] a, int idx) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2185,6 +2145,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ADDReduceDouble128VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2209,6 +2170,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double128VectorTests::ADDReduce, Double128VectorTests::ADDReduceAll);
         }
    +
         static double ADDReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2227,6 +2189,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void ADDReduceDouble128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2253,6 +2216,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double128VectorTests::ADDReduceMasked, Double128VectorTests::ADDReduceAllMasked);
         }
    +
         static double MULReduce(double[] a, int idx) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2270,6 +2234,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MULReduceDouble128VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2294,6 +2259,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double128VectorTests::MULReduce, Double128VectorTests::MULReduceAll);
         }
    +
         static double MULReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2312,6 +2278,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MULReduceDouble128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2338,6 +2305,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double128VectorTests::MULReduceMasked, Double128VectorTests::MULReduceAllMasked);
         }
    +
         static double MINReduce(double[] a, int idx) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2355,6 +2323,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MINReduceDouble128VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2379,6 +2348,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double128VectorTests::MINReduce, Double128VectorTests::MINReduceAll);
         }
    +
         static double MINReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2397,6 +2367,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MINReduceDouble128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2423,6 +2394,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double128VectorTests::MINReduceMasked, Double128VectorTests::MINReduceAllMasked);
         }
    +
         static double MAXReduce(double[] a, int idx) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2440,6 +2412,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MAXReduceDouble128VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2464,6 +2437,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double128VectorTests::MAXReduce, Double128VectorTests::MAXReduceAll);
         }
    +
         static double MAXReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2482,6 +2456,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MAXReduceDouble128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2508,6 +2483,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double128VectorTests::MAXReduceMasked, Double128VectorTests::MAXReduceAllMasked);
         }
    +
         static double FIRST_NONZEROReduce(double[] a, int idx) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2525,6 +2501,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void FIRST_NONZEROReduceDouble128VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2549,6 +2526,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double128VectorTests::FIRST_NONZEROReduce, Double128VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static double FIRST_NONZEROReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2567,6 +2545,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceDouble128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2594,10 +2573,6 @@ public class Double128VectorTests extends AbstractVectorTest {
                     Double128VectorTests::FIRST_NONZEROReduceMasked, Double128VectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void withDouble128VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2615,6 +2590,7 @@ public class Double128VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(double a) {
             return bits(a)==0;
         }
    @@ -2655,6 +2631,7 @@ public class Double128VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(double a) {
             return bits(a)<0;
         }
    @@ -2737,7 +2714,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(double a) {
             return Double.isNaN(a);
         }
    @@ -2779,7 +2755,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(double a) {
             return Double.isInfinite(a);
         }
    @@ -2821,7 +2796,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDouble128VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2841,7 +2815,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDouble128VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2884,7 +2857,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GTDouble128VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2927,7 +2899,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void EQDouble128VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2947,7 +2918,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void eqDouble128VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2990,7 +2960,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void NEDouble128VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3033,7 +3002,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LEDouble128VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3076,7 +3044,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GEDouble128VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3119,15 +3086,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDouble128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3144,7 +3102,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDouble128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3181,7 +3138,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDouble128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3218,7 +3174,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDouble128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3255,7 +3210,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDouble128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3334,6 +3288,43 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void compressDouble128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void expandDouble128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void getDouble128VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3504,10 +3495,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ZeroDouble128VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3522,9 +3509,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static double[] sliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3550,6 +3534,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Double128VectorTests::sliceUnary);
         }
    +
         static double[] sliceBinary(double[] a, double[] b, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3579,6 +3564,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Double128VectorTests::sliceBinary);
         }
    +
         static double[] slice(double[] a, double[] b, int origin, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3612,6 +3598,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Double128VectorTests::slice);
         }
    +
         static double[] unsliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3639,6 +3626,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Double128VectorTests::unsliceUnary);
         }
    +
         static double[] unsliceBinary(double[] a, double[] b, int origin, int part, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3678,6 +3666,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Double128VectorTests::unsliceBinary);
         }
    +
         static double[] unslice(double[] a, double[] b, int origin, int part, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3758,7 +3747,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::SIN, Double128VectorTests::strictSIN);
         }
     
    -
         static double EXP(double a) {
             return (double)(Math.exp((double)a));
         }
    @@ -3782,7 +3770,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::EXP, Double128VectorTests::strictEXP);
         }
     
    -
         static double LOG1P(double a) {
             return (double)(Math.log1p((double)a));
         }
    @@ -3806,7 +3793,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::LOG1P, Double128VectorTests::strictLOG1P);
         }
     
    -
         static double LOG(double a) {
             return (double)(Math.log((double)a));
         }
    @@ -3830,7 +3816,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::LOG, Double128VectorTests::strictLOG);
         }
     
    -
         static double LOG10(double a) {
             return (double)(Math.log10((double)a));
         }
    @@ -3854,7 +3839,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::LOG10, Double128VectorTests::strictLOG10);
         }
     
    -
         static double EXPM1(double a) {
             return (double)(Math.expm1((double)a));
         }
    @@ -3878,7 +3862,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::EXPM1, Double128VectorTests::strictEXPM1);
         }
     
    -
         static double COS(double a) {
             return (double)(Math.cos((double)a));
         }
    @@ -3902,7 +3885,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::COS, Double128VectorTests::strictCOS);
         }
     
    -
         static double TAN(double a) {
             return (double)(Math.tan((double)a));
         }
    @@ -3926,7 +3908,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::TAN, Double128VectorTests::strictTAN);
         }
     
    -
         static double SINH(double a) {
             return (double)(Math.sinh((double)a));
         }
    @@ -3950,7 +3931,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::SINH, Double128VectorTests::strictSINH);
         }
     
    -
         static double COSH(double a) {
             return (double)(Math.cosh((double)a));
         }
    @@ -3974,7 +3954,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::COSH, Double128VectorTests::strictCOSH);
         }
     
    -
         static double TANH(double a) {
             return (double)(Math.tanh((double)a));
         }
    @@ -3998,7 +3977,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::TANH, Double128VectorTests::strictTANH);
         }
     
    -
         static double ASIN(double a) {
             return (double)(Math.asin((double)a));
         }
    @@ -4022,7 +4000,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::ASIN, Double128VectorTests::strictASIN);
         }
     
    -
         static double ACOS(double a) {
             return (double)(Math.acos((double)a));
         }
    @@ -4046,7 +4023,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::ACOS, Double128VectorTests::strictACOS);
         }
     
    -
         static double ATAN(double a) {
             return (double)(Math.atan((double)a));
         }
    @@ -4070,7 +4046,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::ATAN, Double128VectorTests::strictATAN);
         }
     
    -
         static double CBRT(double a) {
             return (double)(Math.cbrt((double)a));
         }
    @@ -4094,7 +4069,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double128VectorTests::CBRT, Double128VectorTests::strictCBRT);
         }
     
    -
         static double HYPOT(double a, double b) {
             return (double)(Math.hypot((double)a, (double)b));
         }
    @@ -4121,7 +4095,6 @@ public class Double128VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double POW(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4147,6 +4120,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, Double128VectorTests::POW, Double128VectorTests::strictPOW);
         }
     
    +
         static double pow(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4173,7 +4147,6 @@ public class Double128VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double ATAN2(double a, double b) {
             return (double)(Math.atan2((double)a, (double)b));
         }
    @@ -4200,7 +4173,6 @@ public class Double128VectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void POWDouble128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4215,6 +4187,7 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Double128VectorTests::POW, Double128VectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void powDouble128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4230,15 +4203,14 @@ public class Double128VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double FMA(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
    +
         static double fma(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4264,6 +4236,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Double128VectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDouble128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4288,7 +4261,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Double128VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4318,10 +4290,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Double128VectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4352,7 +4320,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Double128VectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4391,9 +4358,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Double128VectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4415,6 +4379,7 @@ public class Double128VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Double128VectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDouble128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4437,7 +4402,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Double128VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble128VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4463,9 +4427,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Double128VectorTests::FMA);
         }
     
    -
    -
    -
         static double NEG(double a) {
             return (double)(-((double)a));
         }
    @@ -4578,13 +4539,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Double128VectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static double SQRT(double a) {
             return (double)(Math.sqrt((double)a));
         }
    @@ -4593,8 +4547,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             return (double)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void SQRTDouble128VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4625,8 +4577,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Double128VectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void SQRTMaskedDouble128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4645,7 +4595,6 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Double128VectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDouble128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -5037,6 +4986,23 @@ public class Double128VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Double128VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressDouble128VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5079,6 +5045,20 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongDouble128VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5099,6 +5079,14 @@ public class Double128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongDouble128VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeDouble128VectorTestsSmokeTest() {
             DoubleVector av = DoubleVector.zero(SPECIES);
    @@ -5161,4 +5149,3 @@ public class Double128VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java
    index 4ea890ba015..b6a3fe5fe61 100644
    --- a/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.DoubleVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.DoubleBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfDouble ELEMENT_LAYOUT = ValueLayout.JAVA_DOUBLE.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
     
    @@ -68,17 +70,6 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> DOUBLE_GENERATORS = List.of(
                 withToString("double[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferProvider() {
    +    public Object[][] doubleMemorySegmentProvider() {
             return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferMaskProvider() {
    +    public Object[][] doubleMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] doubleByteArrayProvider() {
    -        return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] doubleByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] doubleByteProviderForIOOBE() {
             var f = DOUBLE_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(double[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (double v : a) {
    -            bb.putDouble(v);
    +    static MemorySegment toSegment(double[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static double[] bufferToArray(ByteBuffer bb) {
    -        DoubleBuffer db = bb.asDoubleBuffer();
    -        double[] d = new double[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(double[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        DoubleBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asDoubleBuffer();
    -        for (double v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static double[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "doubleProvider")
         static void loadStoreArray(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "doubleByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "doubleMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             double[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "doubleByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "doubleByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Double256VectorTests.java b/test/jdk/jdk/incubator/vector/Double256VectorTests.java
    index e3d1a04da31..204743bf5f7 100644
    --- a/test/jdk/jdk/incubator/vector/Double256VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Double256VectorTests.java
    @@ -60,7 +60,6 @@ public class Double256VectorTests extends AbstractVectorTest {
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
     
    -    private static final double CONST_SHIFT = Double.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
     
    @@ -261,6 +260,55 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (double)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (double)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(double[] r, double[] a, double[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1013,8 +1061,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         static long bits(double e) {
             return  Double.doubleToLongBits(e);
         }
    @@ -1198,7 +1244,6 @@ public class Double256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> DOUBLE_COMPARE_GENERATORS = List.of(
                 withToString("double[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1319,7 +1364,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(double a, double b) {
             return a == b;
         }
    @@ -1344,7 +1388,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static double firstNonZero(double a, double b) {
             return Double.compare(a, (double) 0) != 0 ? a : b;
         }
    @@ -1461,6 +1504,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double256VectorTests::ADD);
         }
    +
         static double add(double a, double b) {
             return (double)(a + b);
         }
    @@ -1517,6 +1561,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Double256VectorTests::add);
         }
    +
         static double SUB(double a, double b) {
             return (double)(a - b);
         }
    @@ -1537,6 +1582,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double256VectorTests::SUB);
         }
    +
         static double sub(double a, double b) {
             return (double)(a - b);
         }
    @@ -1593,6 +1639,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Double256VectorTests::sub);
         }
    +
         static double MUL(double a, double b) {
             return (double)(a * b);
         }
    @@ -1613,6 +1660,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double256VectorTests::MUL);
         }
    +
         static double mul(double a, double b) {
             return (double)(a * b);
         }
    @@ -1690,6 +1738,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double256VectorTests::DIV);
         }
    +
         static double div(double a, double b) {
             return (double)(a / b);
         }
    @@ -1709,8 +1758,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Double256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void DIVDouble256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1749,8 +1796,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Double256VectorTests::div);
         }
     
    -
    -
         static double FIRST_NONZERO(double a, double b) {
             return (double)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1792,14 +1837,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Double256VectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void addDouble256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1893,7 +1930,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Double256VectorTests::mul);
         }
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void divDouble256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1908,8 +1944,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Double256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void divDouble256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1927,15 +1961,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Double256VectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void ADDDouble256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1967,63 +1992,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Double256VectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double MIN(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2044,6 +2012,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double256VectorTests::MIN);
         }
    +
         static double min(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2062,6 +2031,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double256VectorTests::min);
         }
    +
         static double MAX(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2082,6 +2052,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double256VectorTests::MAX);
         }
    +
         static double max(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2157,17 +2128,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Double256VectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double ADDReduce(double[] a, int idx) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2185,6 +2145,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ADDReduceDouble256VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2209,6 +2170,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double256VectorTests::ADDReduce, Double256VectorTests::ADDReduceAll);
         }
    +
         static double ADDReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2227,6 +2189,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void ADDReduceDouble256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2253,6 +2216,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double256VectorTests::ADDReduceMasked, Double256VectorTests::ADDReduceAllMasked);
         }
    +
         static double MULReduce(double[] a, int idx) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2270,6 +2234,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MULReduceDouble256VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2294,6 +2259,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double256VectorTests::MULReduce, Double256VectorTests::MULReduceAll);
         }
    +
         static double MULReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2312,6 +2278,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MULReduceDouble256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2338,6 +2305,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double256VectorTests::MULReduceMasked, Double256VectorTests::MULReduceAllMasked);
         }
    +
         static double MINReduce(double[] a, int idx) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2355,6 +2323,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MINReduceDouble256VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2379,6 +2348,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double256VectorTests::MINReduce, Double256VectorTests::MINReduceAll);
         }
    +
         static double MINReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2397,6 +2367,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MINReduceDouble256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2423,6 +2394,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double256VectorTests::MINReduceMasked, Double256VectorTests::MINReduceAllMasked);
         }
    +
         static double MAXReduce(double[] a, int idx) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2440,6 +2412,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MAXReduceDouble256VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2464,6 +2437,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double256VectorTests::MAXReduce, Double256VectorTests::MAXReduceAll);
         }
    +
         static double MAXReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2482,6 +2456,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MAXReduceDouble256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2508,6 +2483,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double256VectorTests::MAXReduceMasked, Double256VectorTests::MAXReduceAllMasked);
         }
    +
         static double FIRST_NONZEROReduce(double[] a, int idx) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2525,6 +2501,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void FIRST_NONZEROReduceDouble256VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2549,6 +2526,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double256VectorTests::FIRST_NONZEROReduce, Double256VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static double FIRST_NONZEROReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2567,6 +2545,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceDouble256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2594,10 +2573,6 @@ public class Double256VectorTests extends AbstractVectorTest {
                     Double256VectorTests::FIRST_NONZEROReduceMasked, Double256VectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void withDouble256VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2615,6 +2590,7 @@ public class Double256VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(double a) {
             return bits(a)==0;
         }
    @@ -2655,6 +2631,7 @@ public class Double256VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(double a) {
             return bits(a)<0;
         }
    @@ -2737,7 +2714,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(double a) {
             return Double.isNaN(a);
         }
    @@ -2779,7 +2755,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(double a) {
             return Double.isInfinite(a);
         }
    @@ -2821,7 +2796,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDouble256VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2841,7 +2815,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDouble256VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2884,7 +2857,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GTDouble256VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2927,7 +2899,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void EQDouble256VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2947,7 +2918,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void eqDouble256VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2990,7 +2960,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void NEDouble256VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3033,7 +3002,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LEDouble256VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3076,7 +3044,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GEDouble256VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3119,15 +3086,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDouble256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3144,7 +3102,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDouble256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3181,7 +3138,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDouble256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3218,7 +3174,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDouble256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3255,7 +3210,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDouble256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3334,6 +3288,43 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void compressDouble256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void expandDouble256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void getDouble256VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3504,10 +3495,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ZeroDouble256VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3522,9 +3509,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static double[] sliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3550,6 +3534,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Double256VectorTests::sliceUnary);
         }
    +
         static double[] sliceBinary(double[] a, double[] b, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3579,6 +3564,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Double256VectorTests::sliceBinary);
         }
    +
         static double[] slice(double[] a, double[] b, int origin, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3612,6 +3598,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Double256VectorTests::slice);
         }
    +
         static double[] unsliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3639,6 +3626,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Double256VectorTests::unsliceUnary);
         }
    +
         static double[] unsliceBinary(double[] a, double[] b, int origin, int part, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3678,6 +3666,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Double256VectorTests::unsliceBinary);
         }
    +
         static double[] unslice(double[] a, double[] b, int origin, int part, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3758,7 +3747,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::SIN, Double256VectorTests::strictSIN);
         }
     
    -
         static double EXP(double a) {
             return (double)(Math.exp((double)a));
         }
    @@ -3782,7 +3770,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::EXP, Double256VectorTests::strictEXP);
         }
     
    -
         static double LOG1P(double a) {
             return (double)(Math.log1p((double)a));
         }
    @@ -3806,7 +3793,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::LOG1P, Double256VectorTests::strictLOG1P);
         }
     
    -
         static double LOG(double a) {
             return (double)(Math.log((double)a));
         }
    @@ -3830,7 +3816,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::LOG, Double256VectorTests::strictLOG);
         }
     
    -
         static double LOG10(double a) {
             return (double)(Math.log10((double)a));
         }
    @@ -3854,7 +3839,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::LOG10, Double256VectorTests::strictLOG10);
         }
     
    -
         static double EXPM1(double a) {
             return (double)(Math.expm1((double)a));
         }
    @@ -3878,7 +3862,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::EXPM1, Double256VectorTests::strictEXPM1);
         }
     
    -
         static double COS(double a) {
             return (double)(Math.cos((double)a));
         }
    @@ -3902,7 +3885,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::COS, Double256VectorTests::strictCOS);
         }
     
    -
         static double TAN(double a) {
             return (double)(Math.tan((double)a));
         }
    @@ -3926,7 +3908,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::TAN, Double256VectorTests::strictTAN);
         }
     
    -
         static double SINH(double a) {
             return (double)(Math.sinh((double)a));
         }
    @@ -3950,7 +3931,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::SINH, Double256VectorTests::strictSINH);
         }
     
    -
         static double COSH(double a) {
             return (double)(Math.cosh((double)a));
         }
    @@ -3974,7 +3954,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::COSH, Double256VectorTests::strictCOSH);
         }
     
    -
         static double TANH(double a) {
             return (double)(Math.tanh((double)a));
         }
    @@ -3998,7 +3977,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::TANH, Double256VectorTests::strictTANH);
         }
     
    -
         static double ASIN(double a) {
             return (double)(Math.asin((double)a));
         }
    @@ -4022,7 +4000,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::ASIN, Double256VectorTests::strictASIN);
         }
     
    -
         static double ACOS(double a) {
             return (double)(Math.acos((double)a));
         }
    @@ -4046,7 +4023,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::ACOS, Double256VectorTests::strictACOS);
         }
     
    -
         static double ATAN(double a) {
             return (double)(Math.atan((double)a));
         }
    @@ -4070,7 +4046,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::ATAN, Double256VectorTests::strictATAN);
         }
     
    -
         static double CBRT(double a) {
             return (double)(Math.cbrt((double)a));
         }
    @@ -4094,7 +4069,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double256VectorTests::CBRT, Double256VectorTests::strictCBRT);
         }
     
    -
         static double HYPOT(double a, double b) {
             return (double)(Math.hypot((double)a, (double)b));
         }
    @@ -4121,7 +4095,6 @@ public class Double256VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double POW(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4147,6 +4120,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, Double256VectorTests::POW, Double256VectorTests::strictPOW);
         }
     
    +
         static double pow(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4173,7 +4147,6 @@ public class Double256VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double ATAN2(double a, double b) {
             return (double)(Math.atan2((double)a, (double)b));
         }
    @@ -4200,7 +4173,6 @@ public class Double256VectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void POWDouble256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4215,6 +4187,7 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Double256VectorTests::POW, Double256VectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void powDouble256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4230,15 +4203,14 @@ public class Double256VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double FMA(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
    +
         static double fma(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4264,6 +4236,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Double256VectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDouble256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4288,7 +4261,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Double256VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4318,10 +4290,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Double256VectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4352,7 +4320,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Double256VectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4391,9 +4358,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Double256VectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4415,6 +4379,7 @@ public class Double256VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Double256VectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDouble256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4437,7 +4402,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Double256VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble256VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4463,9 +4427,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Double256VectorTests::FMA);
         }
     
    -
    -
    -
         static double NEG(double a) {
             return (double)(-((double)a));
         }
    @@ -4578,13 +4539,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Double256VectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static double SQRT(double a) {
             return (double)(Math.sqrt((double)a));
         }
    @@ -4593,8 +4547,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             return (double)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void SQRTDouble256VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4625,8 +4577,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Double256VectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void SQRTMaskedDouble256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4645,7 +4595,6 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Double256VectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDouble256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -5037,6 +4986,23 @@ public class Double256VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Double256VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressDouble256VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5079,6 +5045,20 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongDouble256VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5099,6 +5079,14 @@ public class Double256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongDouble256VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeDouble256VectorTestsSmokeTest() {
             DoubleVector av = DoubleVector.zero(SPECIES);
    @@ -5161,4 +5149,3 @@ public class Double256VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java
    index 2155574794b..99b44ada0aa 100644
    --- a/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.DoubleVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.DoubleBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfDouble ELEMENT_LAYOUT = ValueLayout.JAVA_DOUBLE.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
     
    @@ -68,17 +70,6 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> DOUBLE_GENERATORS = List.of(
                 withToString("double[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferProvider() {
    +    public Object[][] doubleMemorySegmentProvider() {
             return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferMaskProvider() {
    +    public Object[][] doubleMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] doubleByteArrayProvider() {
    -        return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] doubleByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] doubleByteProviderForIOOBE() {
             var f = DOUBLE_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(double[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (double v : a) {
    -            bb.putDouble(v);
    +    static MemorySegment toSegment(double[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static double[] bufferToArray(ByteBuffer bb) {
    -        DoubleBuffer db = bb.asDoubleBuffer();
    -        double[] d = new double[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(double[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        DoubleBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asDoubleBuffer();
    -        for (double v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static double[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "doubleProvider")
         static void loadStoreArray(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "doubleByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "doubleMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             double[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "doubleByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "doubleByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Double512VectorTests.java b/test/jdk/jdk/incubator/vector/Double512VectorTests.java
    index e75141731ca..6c336959e50 100644
    --- a/test/jdk/jdk/incubator/vector/Double512VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Double512VectorTests.java
    @@ -60,7 +60,6 @@ public class Double512VectorTests extends AbstractVectorTest {
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
     
    -    private static final double CONST_SHIFT = Double.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
     
    @@ -261,6 +260,55 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (double)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (double)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(double[] r, double[] a, double[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1013,8 +1061,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         static long bits(double e) {
             return  Double.doubleToLongBits(e);
         }
    @@ -1198,7 +1244,6 @@ public class Double512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> DOUBLE_COMPARE_GENERATORS = List.of(
                 withToString("double[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1319,7 +1364,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(double a, double b) {
             return a == b;
         }
    @@ -1344,7 +1388,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static double firstNonZero(double a, double b) {
             return Double.compare(a, (double) 0) != 0 ? a : b;
         }
    @@ -1461,6 +1504,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double512VectorTests::ADD);
         }
    +
         static double add(double a, double b) {
             return (double)(a + b);
         }
    @@ -1517,6 +1561,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Double512VectorTests::add);
         }
    +
         static double SUB(double a, double b) {
             return (double)(a - b);
         }
    @@ -1537,6 +1582,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double512VectorTests::SUB);
         }
    +
         static double sub(double a, double b) {
             return (double)(a - b);
         }
    @@ -1593,6 +1639,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Double512VectorTests::sub);
         }
    +
         static double MUL(double a, double b) {
             return (double)(a * b);
         }
    @@ -1613,6 +1660,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double512VectorTests::MUL);
         }
    +
         static double mul(double a, double b) {
             return (double)(a * b);
         }
    @@ -1690,6 +1738,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double512VectorTests::DIV);
         }
    +
         static double div(double a, double b) {
             return (double)(a / b);
         }
    @@ -1709,8 +1758,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Double512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void DIVDouble512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1749,8 +1796,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Double512VectorTests::div);
         }
     
    -
    -
         static double FIRST_NONZERO(double a, double b) {
             return (double)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1792,14 +1837,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Double512VectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void addDouble512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1893,7 +1930,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Double512VectorTests::mul);
         }
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void divDouble512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1908,8 +1944,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Double512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void divDouble512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1927,15 +1961,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Double512VectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void ADDDouble512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1967,63 +1992,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Double512VectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double MIN(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2044,6 +2012,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double512VectorTests::MIN);
         }
    +
         static double min(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2062,6 +2031,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double512VectorTests::min);
         }
    +
         static double MAX(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2082,6 +2052,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double512VectorTests::MAX);
         }
    +
         static double max(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2157,17 +2128,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Double512VectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double ADDReduce(double[] a, int idx) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2185,6 +2145,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ADDReduceDouble512VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2209,6 +2170,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double512VectorTests::ADDReduce, Double512VectorTests::ADDReduceAll);
         }
    +
         static double ADDReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2227,6 +2189,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void ADDReduceDouble512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2253,6 +2216,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double512VectorTests::ADDReduceMasked, Double512VectorTests::ADDReduceAllMasked);
         }
    +
         static double MULReduce(double[] a, int idx) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2270,6 +2234,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MULReduceDouble512VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2294,6 +2259,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double512VectorTests::MULReduce, Double512VectorTests::MULReduceAll);
         }
    +
         static double MULReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2312,6 +2278,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MULReduceDouble512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2338,6 +2305,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double512VectorTests::MULReduceMasked, Double512VectorTests::MULReduceAllMasked);
         }
    +
         static double MINReduce(double[] a, int idx) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2355,6 +2323,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MINReduceDouble512VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2379,6 +2348,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double512VectorTests::MINReduce, Double512VectorTests::MINReduceAll);
         }
    +
         static double MINReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2397,6 +2367,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MINReduceDouble512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2423,6 +2394,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double512VectorTests::MINReduceMasked, Double512VectorTests::MINReduceAllMasked);
         }
    +
         static double MAXReduce(double[] a, int idx) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2440,6 +2412,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MAXReduceDouble512VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2464,6 +2437,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double512VectorTests::MAXReduce, Double512VectorTests::MAXReduceAll);
         }
    +
         static double MAXReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2482,6 +2456,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MAXReduceDouble512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2508,6 +2483,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double512VectorTests::MAXReduceMasked, Double512VectorTests::MAXReduceAllMasked);
         }
    +
         static double FIRST_NONZEROReduce(double[] a, int idx) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2525,6 +2501,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void FIRST_NONZEROReduceDouble512VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2549,6 +2526,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double512VectorTests::FIRST_NONZEROReduce, Double512VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static double FIRST_NONZEROReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2567,6 +2545,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceDouble512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2594,10 +2573,6 @@ public class Double512VectorTests extends AbstractVectorTest {
                     Double512VectorTests::FIRST_NONZEROReduceMasked, Double512VectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void withDouble512VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2615,6 +2590,7 @@ public class Double512VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(double a) {
             return bits(a)==0;
         }
    @@ -2655,6 +2631,7 @@ public class Double512VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(double a) {
             return bits(a)<0;
         }
    @@ -2737,7 +2714,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(double a) {
             return Double.isNaN(a);
         }
    @@ -2779,7 +2755,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(double a) {
             return Double.isInfinite(a);
         }
    @@ -2821,7 +2796,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDouble512VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2841,7 +2815,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDouble512VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2884,7 +2857,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GTDouble512VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2927,7 +2899,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void EQDouble512VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2947,7 +2918,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void eqDouble512VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2990,7 +2960,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void NEDouble512VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3033,7 +3002,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LEDouble512VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3076,7 +3044,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GEDouble512VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3119,15 +3086,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDouble512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3144,7 +3102,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDouble512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3181,7 +3138,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDouble512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3218,7 +3174,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDouble512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3255,7 +3210,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDouble512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3334,6 +3288,43 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void compressDouble512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void expandDouble512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void getDouble512VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3504,10 +3495,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ZeroDouble512VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3522,9 +3509,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static double[] sliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3550,6 +3534,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Double512VectorTests::sliceUnary);
         }
    +
         static double[] sliceBinary(double[] a, double[] b, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3579,6 +3564,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Double512VectorTests::sliceBinary);
         }
    +
         static double[] slice(double[] a, double[] b, int origin, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3612,6 +3598,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Double512VectorTests::slice);
         }
    +
         static double[] unsliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3639,6 +3626,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Double512VectorTests::unsliceUnary);
         }
    +
         static double[] unsliceBinary(double[] a, double[] b, int origin, int part, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3678,6 +3666,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Double512VectorTests::unsliceBinary);
         }
    +
         static double[] unslice(double[] a, double[] b, int origin, int part, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3758,7 +3747,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::SIN, Double512VectorTests::strictSIN);
         }
     
    -
         static double EXP(double a) {
             return (double)(Math.exp((double)a));
         }
    @@ -3782,7 +3770,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::EXP, Double512VectorTests::strictEXP);
         }
     
    -
         static double LOG1P(double a) {
             return (double)(Math.log1p((double)a));
         }
    @@ -3806,7 +3793,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::LOG1P, Double512VectorTests::strictLOG1P);
         }
     
    -
         static double LOG(double a) {
             return (double)(Math.log((double)a));
         }
    @@ -3830,7 +3816,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::LOG, Double512VectorTests::strictLOG);
         }
     
    -
         static double LOG10(double a) {
             return (double)(Math.log10((double)a));
         }
    @@ -3854,7 +3839,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::LOG10, Double512VectorTests::strictLOG10);
         }
     
    -
         static double EXPM1(double a) {
             return (double)(Math.expm1((double)a));
         }
    @@ -3878,7 +3862,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::EXPM1, Double512VectorTests::strictEXPM1);
         }
     
    -
         static double COS(double a) {
             return (double)(Math.cos((double)a));
         }
    @@ -3902,7 +3885,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::COS, Double512VectorTests::strictCOS);
         }
     
    -
         static double TAN(double a) {
             return (double)(Math.tan((double)a));
         }
    @@ -3926,7 +3908,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::TAN, Double512VectorTests::strictTAN);
         }
     
    -
         static double SINH(double a) {
             return (double)(Math.sinh((double)a));
         }
    @@ -3950,7 +3931,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::SINH, Double512VectorTests::strictSINH);
         }
     
    -
         static double COSH(double a) {
             return (double)(Math.cosh((double)a));
         }
    @@ -3974,7 +3954,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::COSH, Double512VectorTests::strictCOSH);
         }
     
    -
         static double TANH(double a) {
             return (double)(Math.tanh((double)a));
         }
    @@ -3998,7 +3977,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::TANH, Double512VectorTests::strictTANH);
         }
     
    -
         static double ASIN(double a) {
             return (double)(Math.asin((double)a));
         }
    @@ -4022,7 +4000,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::ASIN, Double512VectorTests::strictASIN);
         }
     
    -
         static double ACOS(double a) {
             return (double)(Math.acos((double)a));
         }
    @@ -4046,7 +4023,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::ACOS, Double512VectorTests::strictACOS);
         }
     
    -
         static double ATAN(double a) {
             return (double)(Math.atan((double)a));
         }
    @@ -4070,7 +4046,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::ATAN, Double512VectorTests::strictATAN);
         }
     
    -
         static double CBRT(double a) {
             return (double)(Math.cbrt((double)a));
         }
    @@ -4094,7 +4069,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::CBRT, Double512VectorTests::strictCBRT);
         }
     
    -
         static double HYPOT(double a, double b) {
             return (double)(Math.hypot((double)a, (double)b));
         }
    @@ -4121,7 +4095,6 @@ public class Double512VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double POW(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4147,6 +4120,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, Double512VectorTests::POW, Double512VectorTests::strictPOW);
         }
     
    +
         static double pow(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4173,7 +4147,6 @@ public class Double512VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double ATAN2(double a, double b) {
             return (double)(Math.atan2((double)a, (double)b));
         }
    @@ -4200,7 +4173,6 @@ public class Double512VectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void POWDouble512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4215,6 +4187,7 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Double512VectorTests::POW, Double512VectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void powDouble512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4230,15 +4203,14 @@ public class Double512VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double FMA(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
    +
         static double fma(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4264,6 +4236,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Double512VectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDouble512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4288,7 +4261,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Double512VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4318,10 +4290,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Double512VectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4352,7 +4320,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Double512VectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4391,9 +4358,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Double512VectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4415,6 +4379,7 @@ public class Double512VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Double512VectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDouble512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4437,7 +4402,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Double512VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble512VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4463,9 +4427,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Double512VectorTests::FMA);
         }
     
    -
    -
    -
         static double NEG(double a) {
             return (double)(-((double)a));
         }
    @@ -4578,13 +4539,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Double512VectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static double SQRT(double a) {
             return (double)(Math.sqrt((double)a));
         }
    @@ -4593,8 +4547,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             return (double)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void SQRTDouble512VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4625,8 +4577,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Double512VectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void SQRTMaskedDouble512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4645,7 +4595,6 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Double512VectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDouble512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -5037,6 +4986,23 @@ public class Double512VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Double512VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressDouble512VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5079,6 +5045,20 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongDouble512VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5099,6 +5079,14 @@ public class Double512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongDouble512VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeDouble512VectorTestsSmokeTest() {
             DoubleVector av = DoubleVector.zero(SPECIES);
    @@ -5161,4 +5149,3 @@ public class Double512VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java
    index 2bad014ca85..b69de8938a5 100644
    --- a/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.DoubleVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.DoubleBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfDouble ELEMENT_LAYOUT = ValueLayout.JAVA_DOUBLE.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
     
    @@ -68,17 +70,6 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> DOUBLE_GENERATORS = List.of(
                 withToString("double[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferProvider() {
    +    public Object[][] doubleMemorySegmentProvider() {
             return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferMaskProvider() {
    +    public Object[][] doubleMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] doubleByteArrayProvider() {
    -        return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] doubleByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] doubleByteProviderForIOOBE() {
             var f = DOUBLE_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(double[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (double v : a) {
    -            bb.putDouble(v);
    +    static MemorySegment toSegment(double[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static double[] bufferToArray(ByteBuffer bb) {
    -        DoubleBuffer db = bb.asDoubleBuffer();
    -        double[] d = new double[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(double[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        DoubleBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asDoubleBuffer();
    -        for (double v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static double[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "doubleProvider")
         static void loadStoreArray(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "doubleByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "doubleMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             double[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "doubleByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "doubleByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Double64VectorTests.java b/test/jdk/jdk/incubator/vector/Double64VectorTests.java
    index c8e7a5eed5c..abcec6533bf 100644
    --- a/test/jdk/jdk/incubator/vector/Double64VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Double64VectorTests.java
    @@ -60,7 +60,6 @@ public class Double64VectorTests extends AbstractVectorTest {
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
     
    -    private static final double CONST_SHIFT = Double.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
     
    @@ -261,6 +260,55 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (double)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (double)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(double[] r, double[] a, double[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1013,8 +1061,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         static long bits(double e) {
             return  Double.doubleToLongBits(e);
         }
    @@ -1198,7 +1244,6 @@ public class Double64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> DOUBLE_COMPARE_GENERATORS = List.of(
                 withToString("double[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1319,7 +1364,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(double a, double b) {
             return a == b;
         }
    @@ -1344,7 +1388,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static double firstNonZero(double a, double b) {
             return Double.compare(a, (double) 0) != 0 ? a : b;
         }
    @@ -1461,6 +1504,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double64VectorTests::ADD);
         }
    +
         static double add(double a, double b) {
             return (double)(a + b);
         }
    @@ -1517,6 +1561,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Double64VectorTests::add);
         }
    +
         static double SUB(double a, double b) {
             return (double)(a - b);
         }
    @@ -1537,6 +1582,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double64VectorTests::SUB);
         }
    +
         static double sub(double a, double b) {
             return (double)(a - b);
         }
    @@ -1593,6 +1639,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Double64VectorTests::sub);
         }
    +
         static double MUL(double a, double b) {
             return (double)(a * b);
         }
    @@ -1613,6 +1660,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double64VectorTests::MUL);
         }
    +
         static double mul(double a, double b) {
             return (double)(a * b);
         }
    @@ -1690,6 +1738,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double64VectorTests::DIV);
         }
    +
         static double div(double a, double b) {
             return (double)(a / b);
         }
    @@ -1709,8 +1758,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Double64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void DIVDouble64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1749,8 +1796,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Double64VectorTests::div);
         }
     
    -
    -
         static double FIRST_NONZERO(double a, double b) {
             return (double)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1792,14 +1837,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Double64VectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void addDouble64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1893,7 +1930,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Double64VectorTests::mul);
         }
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void divDouble64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1908,8 +1944,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Double64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void divDouble64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1927,15 +1961,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Double64VectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void ADDDouble64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1967,63 +1992,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Double64VectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double MIN(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2044,6 +2012,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double64VectorTests::MIN);
         }
    +
         static double min(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2062,6 +2031,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double64VectorTests::min);
         }
    +
         static double MAX(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2082,6 +2052,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Double64VectorTests::MAX);
         }
    +
         static double max(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2157,17 +2128,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Double64VectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double ADDReduce(double[] a, int idx) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2185,6 +2145,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ADDReduceDouble64VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2209,6 +2170,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double64VectorTests::ADDReduce, Double64VectorTests::ADDReduceAll);
         }
    +
         static double ADDReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2227,6 +2189,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void ADDReduceDouble64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2253,6 +2216,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double64VectorTests::ADDReduceMasked, Double64VectorTests::ADDReduceAllMasked);
         }
    +
         static double MULReduce(double[] a, int idx) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2270,6 +2234,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MULReduceDouble64VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2294,6 +2259,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double64VectorTests::MULReduce, Double64VectorTests::MULReduceAll);
         }
    +
         static double MULReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2312,6 +2278,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MULReduceDouble64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2338,6 +2305,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double64VectorTests::MULReduceMasked, Double64VectorTests::MULReduceAllMasked);
         }
    +
         static double MINReduce(double[] a, int idx) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2355,6 +2323,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MINReduceDouble64VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2379,6 +2348,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double64VectorTests::MINReduce, Double64VectorTests::MINReduceAll);
         }
    +
         static double MINReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2397,6 +2367,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MINReduceDouble64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2423,6 +2394,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double64VectorTests::MINReduceMasked, Double64VectorTests::MINReduceAllMasked);
         }
    +
         static double MAXReduce(double[] a, int idx) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2440,6 +2412,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MAXReduceDouble64VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2464,6 +2437,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double64VectorTests::MAXReduce, Double64VectorTests::MAXReduceAll);
         }
    +
         static double MAXReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2482,6 +2456,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MAXReduceDouble64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2508,6 +2483,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Double64VectorTests::MAXReduceMasked, Double64VectorTests::MAXReduceAllMasked);
         }
    +
         static double FIRST_NONZEROReduce(double[] a, int idx) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2525,6 +2501,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void FIRST_NONZEROReduceDouble64VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2549,6 +2526,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Double64VectorTests::FIRST_NONZEROReduce, Double64VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static double FIRST_NONZEROReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2567,6 +2545,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceDouble64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2594,10 +2573,6 @@ public class Double64VectorTests extends AbstractVectorTest {
                     Double64VectorTests::FIRST_NONZEROReduceMasked, Double64VectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void withDouble64VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2615,6 +2590,7 @@ public class Double64VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(double a) {
             return bits(a)==0;
         }
    @@ -2655,6 +2631,7 @@ public class Double64VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(double a) {
             return bits(a)<0;
         }
    @@ -2737,7 +2714,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(double a) {
             return Double.isNaN(a);
         }
    @@ -2779,7 +2755,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(double a) {
             return Double.isInfinite(a);
         }
    @@ -2821,7 +2796,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDouble64VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2841,7 +2815,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDouble64VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2884,7 +2857,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GTDouble64VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2927,7 +2899,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void EQDouble64VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2947,7 +2918,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void eqDouble64VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2990,7 +2960,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void NEDouble64VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3033,7 +3002,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LEDouble64VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3076,7 +3044,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GEDouble64VectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3119,15 +3086,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDouble64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3144,7 +3102,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDouble64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3181,7 +3138,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDouble64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3218,7 +3174,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDouble64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3255,7 +3210,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDouble64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3334,6 +3288,43 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void compressDouble64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void expandDouble64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void getDouble64VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3504,10 +3495,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ZeroDouble64VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3522,9 +3509,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static double[] sliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3550,6 +3534,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Double64VectorTests::sliceUnary);
         }
    +
         static double[] sliceBinary(double[] a, double[] b, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3579,6 +3564,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Double64VectorTests::sliceBinary);
         }
    +
         static double[] slice(double[] a, double[] b, int origin, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3612,6 +3598,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Double64VectorTests::slice);
         }
    +
         static double[] unsliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3639,6 +3626,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Double64VectorTests::unsliceUnary);
         }
    +
         static double[] unsliceBinary(double[] a, double[] b, int origin, int part, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3678,6 +3666,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Double64VectorTests::unsliceBinary);
         }
    +
         static double[] unslice(double[] a, double[] b, int origin, int part, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3758,7 +3747,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::SIN, Double64VectorTests::strictSIN);
         }
     
    -
         static double EXP(double a) {
             return (double)(Math.exp((double)a));
         }
    @@ -3782,7 +3770,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::EXP, Double64VectorTests::strictEXP);
         }
     
    -
         static double LOG1P(double a) {
             return (double)(Math.log1p((double)a));
         }
    @@ -3806,7 +3793,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::LOG1P, Double64VectorTests::strictLOG1P);
         }
     
    -
         static double LOG(double a) {
             return (double)(Math.log((double)a));
         }
    @@ -3830,7 +3816,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::LOG, Double64VectorTests::strictLOG);
         }
     
    -
         static double LOG10(double a) {
             return (double)(Math.log10((double)a));
         }
    @@ -3854,7 +3839,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::LOG10, Double64VectorTests::strictLOG10);
         }
     
    -
         static double EXPM1(double a) {
             return (double)(Math.expm1((double)a));
         }
    @@ -3878,7 +3862,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::EXPM1, Double64VectorTests::strictEXPM1);
         }
     
    -
         static double COS(double a) {
             return (double)(Math.cos((double)a));
         }
    @@ -3902,7 +3885,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::COS, Double64VectorTests::strictCOS);
         }
     
    -
         static double TAN(double a) {
             return (double)(Math.tan((double)a));
         }
    @@ -3926,7 +3908,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::TAN, Double64VectorTests::strictTAN);
         }
     
    -
         static double SINH(double a) {
             return (double)(Math.sinh((double)a));
         }
    @@ -3950,7 +3931,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::SINH, Double64VectorTests::strictSINH);
         }
     
    -
         static double COSH(double a) {
             return (double)(Math.cosh((double)a));
         }
    @@ -3974,7 +3954,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::COSH, Double64VectorTests::strictCOSH);
         }
     
    -
         static double TANH(double a) {
             return (double)(Math.tanh((double)a));
         }
    @@ -3998,7 +3977,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::TANH, Double64VectorTests::strictTANH);
         }
     
    -
         static double ASIN(double a) {
             return (double)(Math.asin((double)a));
         }
    @@ -4022,7 +4000,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::ASIN, Double64VectorTests::strictASIN);
         }
     
    -
         static double ACOS(double a) {
             return (double)(Math.acos((double)a));
         }
    @@ -4046,7 +4023,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::ACOS, Double64VectorTests::strictACOS);
         }
     
    -
         static double ATAN(double a) {
             return (double)(Math.atan((double)a));
         }
    @@ -4070,7 +4046,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::ATAN, Double64VectorTests::strictATAN);
         }
     
    -
         static double CBRT(double a) {
             return (double)(Math.cbrt((double)a));
         }
    @@ -4094,7 +4069,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Double64VectorTests::CBRT, Double64VectorTests::strictCBRT);
         }
     
    -
         static double HYPOT(double a, double b) {
             return (double)(Math.hypot((double)a, (double)b));
         }
    @@ -4121,7 +4095,6 @@ public class Double64VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double POW(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4147,6 +4120,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, Double64VectorTests::POW, Double64VectorTests::strictPOW);
         }
     
    +
         static double pow(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4173,7 +4147,6 @@ public class Double64VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double ATAN2(double a, double b) {
             return (double)(Math.atan2((double)a, (double)b));
         }
    @@ -4200,7 +4173,6 @@ public class Double64VectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void POWDouble64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4215,6 +4187,7 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Double64VectorTests::POW, Double64VectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void powDouble64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4230,15 +4203,14 @@ public class Double64VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double FMA(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
    +
         static double fma(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4264,6 +4236,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Double64VectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDouble64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4288,7 +4261,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Double64VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4318,10 +4290,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Double64VectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4352,7 +4320,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Double64VectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4391,9 +4358,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Double64VectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADouble64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4415,6 +4379,7 @@ public class Double64VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Double64VectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDouble64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4437,7 +4402,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Double64VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADouble64VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4463,9 +4427,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Double64VectorTests::FMA);
         }
     
    -
    -
    -
         static double NEG(double a) {
             return (double)(-((double)a));
         }
    @@ -4578,13 +4539,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Double64VectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static double SQRT(double a) {
             return (double)(Math.sqrt((double)a));
         }
    @@ -4593,8 +4547,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             return (double)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void SQRTDouble64VectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4625,8 +4577,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Double64VectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void SQRTMaskedDouble64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4645,7 +4595,6 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Double64VectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDouble64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -5037,6 +4986,23 @@ public class Double64VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Double64VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressDouble64VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5079,6 +5045,20 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongDouble64VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5099,6 +5079,14 @@ public class Double64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongDouble64VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeDouble64VectorTestsSmokeTest() {
             DoubleVector av = DoubleVector.zero(SPECIES);
    @@ -5161,4 +5149,3 @@ public class Double64VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java
    index 1e7f2e78aa1..eb8d201bee5 100644
    --- a/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java
    @@ -32,6 +32,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.DoubleVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorShape;
    @@ -42,12 +45,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.lang.invoke.MethodHandles;
    -import java.lang.invoke.VarHandle;
    -import java.nio.ByteBuffer;
    -import java.nio.DoubleBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -58,6 +56,8 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfDouble ELEMENT_LAYOUT = ValueLayout.JAVA_DOUBLE.withBitAlignment(8);
    +
         static VectorShape getMaxBit() {
             return VectorShape.S_Max_BIT;
         }
    @@ -77,17 +77,6 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> DOUBLE_GENERATORS = List.of(
                 withToString("double[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -127,7 +116,7 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -198,9 +187,9 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferProvider() {
    +    public Object[][] doubleMemorySegmentProvider() {
             return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -208,35 +197,16 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] doubleByteBufferMaskProvider() {
    +    public Object[][] doubleMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] doubleByteArrayProvider() {
    -        return DOUBLE_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] doubleByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> DOUBLE_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] doubleByteProviderForIOOBE() {
             var f = DOUBLE_GENERATORS.get(0);
    @@ -256,28 +226,16 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(double[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (double v : a) {
    -            bb.putDouble(v);
    +    static MemorySegment toSegment(double[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static double[] bufferToArray(ByteBuffer bb) {
    -        DoubleBuffer db = bb.asDoubleBuffer();
    -        double[] d = new double[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(double[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        DoubleBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asDoubleBuffer();
    -        for (double v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static double[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -317,46 +275,25 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static DoubleVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static DoubleVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return DoubleVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(DoubleVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(DoubleVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static DoubleVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return DoubleVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(DoubleVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "doubleProvider")
         static void loadStoreArray(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -527,48 +464,45 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -580,25 +514,25 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -609,70 +543,61 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "doubleByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "doubleMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             double[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                DoubleVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -684,27 +609,27 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Double.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Double.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            DoubleVector av = DoubleVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            DoubleVector av = DoubleVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -715,214 +640,36 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "doubleMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "doubleByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "doubleByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "doubleByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "doubleByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            DoubleVector av = DoubleVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -937,6 +684,7 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java b/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java
    index 86e524f5924..ef41e6a6cbb 100644
    --- a/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java
    @@ -65,7 +65,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
         private static final int Max = 256;  // juts so we can do N/Max
     
    -    private static final double CONST_SHIFT = Double.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
     
    @@ -266,6 +265,55 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (double)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(double[] r, double[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (double)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (double)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(double[] r, double[] a, double[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1018,8 +1066,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         static long bits(double e) {
             return  Double.doubleToLongBits(e);
         }
    @@ -1203,7 +1249,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> DOUBLE_COMPARE_GENERATORS = List.of(
                 withToString("double[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1324,7 +1369,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(double a, double b) {
             return a == b;
         }
    @@ -1349,7 +1393,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static double firstNonZero(double a, double b) {
             return Double.compare(a, (double) 0) != 0 ? a : b;
         }
    @@ -1466,6 +1509,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, DoubleMaxVectorTests::ADD);
         }
    +
         static double add(double a, double b) {
             return (double)(a + b);
         }
    @@ -1522,6 +1566,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, DoubleMaxVectorTests::add);
         }
    +
         static double SUB(double a, double b) {
             return (double)(a - b);
         }
    @@ -1542,6 +1587,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, DoubleMaxVectorTests::SUB);
         }
    +
         static double sub(double a, double b) {
             return (double)(a - b);
         }
    @@ -1598,6 +1644,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, DoubleMaxVectorTests::sub);
         }
    +
         static double MUL(double a, double b) {
             return (double)(a * b);
         }
    @@ -1618,6 +1665,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, DoubleMaxVectorTests::MUL);
         }
    +
         static double mul(double a, double b) {
             return (double)(a * b);
         }
    @@ -1695,6 +1743,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, DoubleMaxVectorTests::DIV);
         }
    +
         static double div(double a, double b) {
             return (double)(a / b);
         }
    @@ -1714,8 +1763,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, DoubleMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void DIVDoubleMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1754,8 +1801,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, DoubleMaxVectorTests::div);
         }
     
    -
    -
         static double FIRST_NONZERO(double a, double b) {
             return (double)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1797,14 +1842,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, DoubleMaxVectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void addDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1898,7 +1935,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, DoubleMaxVectorTests::mul);
         }
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void divDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1913,8 +1949,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, DoubleMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "doubleBinaryOpMaskProvider")
         static void divDoubleMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1932,15 +1966,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, DoubleMaxVectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void ADDDoubleMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -1972,63 +1997,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, DoubleMaxVectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double MIN(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2049,6 +2017,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, DoubleMaxVectorTests::MIN);
         }
    +
         static double min(double a, double b) {
             return (double)(Math.min(a, b));
         }
    @@ -2067,6 +2036,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, DoubleMaxVectorTests::min);
         }
    +
         static double MAX(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2087,6 +2057,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, DoubleMaxVectorTests::MAX);
         }
    +
         static double max(double a, double b) {
             return (double)(Math.max(a, b));
         }
    @@ -2162,17 +2133,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, DoubleMaxVectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static double ADDReduce(double[] a, int idx) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2190,6 +2150,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ADDReduceDoubleMaxVectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2214,6 +2175,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     DoubleMaxVectorTests::ADDReduce, DoubleMaxVectorTests::ADDReduceAll);
         }
    +
         static double ADDReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2232,6 +2194,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void ADDReduceDoubleMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2258,6 +2221,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     DoubleMaxVectorTests::ADDReduceMasked, DoubleMaxVectorTests::ADDReduceAllMasked);
         }
    +
         static double MULReduce(double[] a, int idx) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2275,6 +2239,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MULReduceDoubleMaxVectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2299,6 +2264,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     DoubleMaxVectorTests::MULReduce, DoubleMaxVectorTests::MULReduceAll);
         }
    +
         static double MULReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2317,6 +2283,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MULReduceDoubleMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2343,6 +2310,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     DoubleMaxVectorTests::MULReduceMasked, DoubleMaxVectorTests::MULReduceAllMasked);
         }
    +
         static double MINReduce(double[] a, int idx) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2360,6 +2328,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MINReduceDoubleMaxVectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2384,6 +2353,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     DoubleMaxVectorTests::MINReduce, DoubleMaxVectorTests::MINReduceAll);
         }
    +
         static double MINReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2402,6 +2372,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MINReduceDoubleMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2428,6 +2399,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     DoubleMaxVectorTests::MINReduceMasked, DoubleMaxVectorTests::MINReduceAllMasked);
         }
    +
         static double MAXReduce(double[] a, int idx) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2445,6 +2417,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void MAXReduceDoubleMaxVectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2469,6 +2442,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     DoubleMaxVectorTests::MAXReduce, DoubleMaxVectorTests::MAXReduceAll);
         }
    +
         static double MAXReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = Double.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2487,6 +2461,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void MAXReduceDoubleMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2513,6 +2488,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     DoubleMaxVectorTests::MAXReduceMasked, DoubleMaxVectorTests::MAXReduceAllMasked);
         }
    +
         static double FIRST_NONZEROReduce(double[] a, int idx) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2530,6 +2506,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void FIRST_NONZEROReduceDoubleMaxVectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2554,6 +2531,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     DoubleMaxVectorTests::FIRST_NONZEROReduce, DoubleMaxVectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static double FIRST_NONZEROReduceMasked(double[] a, int idx, boolean[] mask) {
             double res = (double) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2572,6 +2550,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceDoubleMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2599,10 +2578,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
                     DoubleMaxVectorTests::FIRST_NONZEROReduceMasked, DoubleMaxVectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void withDoubleMaxVectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2620,6 +2595,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(double a) {
             return bits(a)==0;
         }
    @@ -2660,6 +2636,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(double a) {
             return bits(a)<0;
         }
    @@ -2742,7 +2719,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(double a) {
             return Double.isNaN(a);
         }
    @@ -2784,7 +2760,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(double a) {
             return Double.isInfinite(a);
         }
    @@ -2826,7 +2801,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDoubleMaxVectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2846,7 +2820,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDoubleMaxVectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2889,7 +2862,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GTDoubleMaxVectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2932,7 +2904,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void EQDoubleMaxVectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2952,7 +2923,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void eqDoubleMaxVectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -2995,7 +2965,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void NEDoubleMaxVectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3038,7 +3007,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LEDoubleMaxVectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3081,7 +3049,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void GEDoubleMaxVectorTests(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3124,15 +3091,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void LTDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3149,7 +3107,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDoubleMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3186,7 +3143,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void LTDoubleMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3223,7 +3179,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDoubleMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3260,7 +3215,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "doubleCompareOpMaskProvider")
         static void EQDoubleMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3339,6 +3293,43 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void compressDoubleMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "doubleUnaryOpMaskProvider")
    +    static void expandDoubleMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        double[] a = fa.apply(SPECIES.length());
    +        double[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void getDoubleMaxVectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3509,10 +3500,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void ZeroDoubleMaxVectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -3527,9 +3514,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static double[] sliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3555,6 +3539,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, DoubleMaxVectorTests::sliceUnary);
         }
    +
         static double[] sliceBinary(double[] a, double[] b, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3584,6 +3569,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, DoubleMaxVectorTests::sliceBinary);
         }
    +
         static double[] slice(double[] a, double[] b, int origin, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3617,6 +3603,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, DoubleMaxVectorTests::slice);
         }
    +
         static double[] unsliceUnary(double[] a, int origin, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3644,6 +3631,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, DoubleMaxVectorTests::unsliceUnary);
         }
    +
         static double[] unsliceBinary(double[] a, double[] b, int origin, int part, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3683,6 +3671,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, DoubleMaxVectorTests::unsliceBinary);
         }
    +
         static double[] unslice(double[] a, double[] b, int origin, int part, boolean[] mask, int idx) {
             double[] res = new double[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3763,7 +3752,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::SIN, DoubleMaxVectorTests::strictSIN);
         }
     
    -
         static double EXP(double a) {
             return (double)(Math.exp((double)a));
         }
    @@ -3787,7 +3775,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::EXP, DoubleMaxVectorTests::strictEXP);
         }
     
    -
         static double LOG1P(double a) {
             return (double)(Math.log1p((double)a));
         }
    @@ -3811,7 +3798,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::LOG1P, DoubleMaxVectorTests::strictLOG1P);
         }
     
    -
         static double LOG(double a) {
             return (double)(Math.log((double)a));
         }
    @@ -3835,7 +3821,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::LOG, DoubleMaxVectorTests::strictLOG);
         }
     
    -
         static double LOG10(double a) {
             return (double)(Math.log10((double)a));
         }
    @@ -3859,7 +3844,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::LOG10, DoubleMaxVectorTests::strictLOG10);
         }
     
    -
         static double EXPM1(double a) {
             return (double)(Math.expm1((double)a));
         }
    @@ -3883,7 +3867,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::EXPM1, DoubleMaxVectorTests::strictEXPM1);
         }
     
    -
         static double COS(double a) {
             return (double)(Math.cos((double)a));
         }
    @@ -3907,7 +3890,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::COS, DoubleMaxVectorTests::strictCOS);
         }
     
    -
         static double TAN(double a) {
             return (double)(Math.tan((double)a));
         }
    @@ -3931,7 +3913,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::TAN, DoubleMaxVectorTests::strictTAN);
         }
     
    -
         static double SINH(double a) {
             return (double)(Math.sinh((double)a));
         }
    @@ -3955,7 +3936,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::SINH, DoubleMaxVectorTests::strictSINH);
         }
     
    -
         static double COSH(double a) {
             return (double)(Math.cosh((double)a));
         }
    @@ -3979,7 +3959,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::COSH, DoubleMaxVectorTests::strictCOSH);
         }
     
    -
         static double TANH(double a) {
             return (double)(Math.tanh((double)a));
         }
    @@ -4003,7 +3982,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::TANH, DoubleMaxVectorTests::strictTANH);
         }
     
    -
         static double ASIN(double a) {
             return (double)(Math.asin((double)a));
         }
    @@ -4027,7 +4005,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::ASIN, DoubleMaxVectorTests::strictASIN);
         }
     
    -
         static double ACOS(double a) {
             return (double)(Math.acos((double)a));
         }
    @@ -4051,7 +4028,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::ACOS, DoubleMaxVectorTests::strictACOS);
         }
     
    -
         static double ATAN(double a) {
             return (double)(Math.atan((double)a));
         }
    @@ -4075,7 +4051,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::ATAN, DoubleMaxVectorTests::strictATAN);
         }
     
    -
         static double CBRT(double a) {
             return (double)(Math.cbrt((double)a));
         }
    @@ -4099,7 +4074,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, DoubleMaxVectorTests::CBRT, DoubleMaxVectorTests::strictCBRT);
         }
     
    -
         static double HYPOT(double a, double b) {
             return (double)(Math.hypot((double)a, (double)b));
         }
    @@ -4126,7 +4100,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double POW(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4152,6 +4125,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, DoubleMaxVectorTests::POW, DoubleMaxVectorTests::strictPOW);
         }
     
    +
         static double pow(double a, double b) {
             return (double)(Math.pow((double)a, (double)b));
         }
    @@ -4178,7 +4152,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double ATAN2(double a, double b) {
             return (double)(Math.atan2((double)a, (double)b));
         }
    @@ -4205,7 +4178,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void POWDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4220,6 +4192,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, DoubleMaxVectorTests::POW, DoubleMaxVectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "doubleBinaryOpProvider")
         static void powDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4235,15 +4208,14 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
         }
     
     
    -
         static double FMA(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
    +
         static double fma(double a, double b, double c) {
             return (double)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADoubleMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4269,6 +4241,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, DoubleMaxVectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDoubleMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4293,7 +4266,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, DoubleMaxVectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADoubleMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4323,10 +4295,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, DoubleMaxVectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADoubleMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4357,7 +4325,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, DoubleMaxVectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADoubleMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4396,9 +4363,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, DoubleMaxVectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void FMADoubleMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4420,6 +4384,7 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, DoubleMaxVectorTests::FMA);
         }
    +
         @Test(dataProvider = "doubleTernaryOpProvider")
         static void fmaDoubleMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int count = INVOC_COUNT;
    @@ -4442,7 +4407,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, DoubleMaxVectorTests::fma);
         }
     
    -
         @Test(dataProvider = "doubleTernaryOpMaskProvider")
         static void FMADoubleMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4468,9 +4432,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, DoubleMaxVectorTests::FMA);
         }
     
    -
    -
    -
         static double NEG(double a) {
             return (double)(-((double)a));
         }
    @@ -4583,13 +4544,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, DoubleMaxVectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static double SQRT(double a) {
             return (double)(Math.sqrt((double)a));
         }
    @@ -4598,8 +4552,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             return (double)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpProvider")
         static void SQRTDoubleMaxVectorTests(IntFunction fa) {
             double[] a = fa.apply(SPECIES.length());
    @@ -4630,8 +4582,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, DoubleMaxVectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "doubleUnaryOpMaskProvider")
         static void SQRTMaskedDoubleMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4650,7 +4600,6 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, DoubleMaxVectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "doubleCompareOpProvider")
         static void ltDoubleMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             double[] a = fa.apply(SPECIES.length());
    @@ -5042,6 +4991,23 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, DoubleMaxVectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressDoubleMaxVectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
     
         @DataProvider
         public static Object[][] offsetProvider() {
    @@ -5068,6 +5034,20 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongDoubleMaxVectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5088,6 +5068,14 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongDoubleMaxVectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeDoubleMaxVectorTestsSmokeTest() {
             DoubleVector av = DoubleVector.zero(SPECIES);
    @@ -5150,4 +5138,3 @@ public class DoubleMaxVectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java
    index 5aa98c52908..2efaf867c66 100644
    --- a/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.FloatVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.FloatBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfFloat ELEMENT_LAYOUT = ValueLayout.JAVA_FLOAT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
     
    @@ -68,17 +70,6 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> FLOAT_GENERATORS = List.of(
                 withToString("float[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferProvider() {
    +    public Object[][] floatMemorySegmentProvider() {
             return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferMaskProvider() {
    +    public Object[][] floatMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> FLOAT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] floatByteArrayProvider() {
    -        return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] floatByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> FLOAT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] floatByteProviderForIOOBE() {
             var f = FLOAT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(float[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (float v : a) {
    -            bb.putFloat(v);
    +    static MemorySegment toSegment(float[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static float[] bufferToArray(ByteBuffer bb) {
    -        FloatBuffer db = bb.asFloatBuffer();
    -        float[] d = new float[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(float[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        FloatBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asFloatBuffer();
    -        for (float v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static float[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "floatProvider")
         static void loadStoreArray(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "floatByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "floatMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             float[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "floatByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "floatByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Float128VectorTests.java b/test/jdk/jdk/incubator/vector/Float128VectorTests.java
    index ec0851fdd34..f888604905b 100644
    --- a/test/jdk/jdk/incubator/vector/Float128VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Float128VectorTests.java
    @@ -60,7 +60,6 @@ public class Float128VectorTests extends AbstractVectorTest {
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
     
    -    private static final float CONST_SHIFT = Float.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
     
    @@ -261,6 +260,55 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (float)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (float)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(float[] r, float[] a, float[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1024,7 +1072,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(float e) {
             return  Float.floatToIntBits(e);
         }
    @@ -1208,7 +1255,6 @@ public class Float128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> FLOAT_COMPARE_GENERATORS = List.of(
                 withToString("float[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1329,7 +1375,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(float a, float b) {
             return a == b;
         }
    @@ -1354,7 +1399,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static float firstNonZero(float a, float b) {
             return Float.compare(a, (float) 0) != 0 ? a : b;
         }
    @@ -1471,6 +1515,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float128VectorTests::ADD);
         }
    +
         static float add(float a, float b) {
             return (float)(a + b);
         }
    @@ -1527,6 +1572,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Float128VectorTests::add);
         }
    +
         static float SUB(float a, float b) {
             return (float)(a - b);
         }
    @@ -1547,6 +1593,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float128VectorTests::SUB);
         }
    +
         static float sub(float a, float b) {
             return (float)(a - b);
         }
    @@ -1603,6 +1650,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Float128VectorTests::sub);
         }
    +
         static float MUL(float a, float b) {
             return (float)(a * b);
         }
    @@ -1623,6 +1671,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float128VectorTests::MUL);
         }
    +
         static float mul(float a, float b) {
             return (float)(a * b);
         }
    @@ -1700,6 +1749,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float128VectorTests::DIV);
         }
    +
         static float div(float a, float b) {
             return (float)(a / b);
         }
    @@ -1719,8 +1769,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Float128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void DIVFloat128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1759,8 +1807,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Float128VectorTests::div);
         }
     
    -
    -
         static float FIRST_NONZERO(float a, float b) {
             return (float)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1802,14 +1848,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Float128VectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void addFloat128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1903,7 +1941,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::mul);
         }
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void divFloat128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1918,8 +1955,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Float128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void divFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1937,15 +1972,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void ADDFloat128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1977,63 +2003,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Float128VectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float MIN(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2054,6 +2023,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float128VectorTests::MIN);
         }
    +
         static float min(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2072,6 +2042,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float128VectorTests::min);
         }
    +
         static float MAX(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2092,6 +2063,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float128VectorTests::MAX);
         }
    +
         static float max(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2167,17 +2139,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Float128VectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float ADDReduce(float[] a, int idx) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2195,6 +2156,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ADDReduceFloat128VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2219,6 +2181,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float128VectorTests::ADDReduce, Float128VectorTests::ADDReduceAll);
         }
    +
         static float ADDReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2237,6 +2200,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void ADDReduceFloat128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2263,6 +2227,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float128VectorTests::ADDReduceMasked, Float128VectorTests::ADDReduceAllMasked);
         }
    +
         static float MULReduce(float[] a, int idx) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2280,6 +2245,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MULReduceFloat128VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2304,6 +2270,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float128VectorTests::MULReduce, Float128VectorTests::MULReduceAll);
         }
    +
         static float MULReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2322,6 +2289,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MULReduceFloat128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2348,6 +2316,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float128VectorTests::MULReduceMasked, Float128VectorTests::MULReduceAllMasked);
         }
    +
         static float MINReduce(float[] a, int idx) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2365,6 +2334,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MINReduceFloat128VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2389,6 +2359,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float128VectorTests::MINReduce, Float128VectorTests::MINReduceAll);
         }
    +
         static float MINReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2407,6 +2378,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MINReduceFloat128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2433,6 +2405,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float128VectorTests::MINReduceMasked, Float128VectorTests::MINReduceAllMasked);
         }
    +
         static float MAXReduce(float[] a, int idx) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2450,6 +2423,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MAXReduceFloat128VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2474,6 +2448,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float128VectorTests::MAXReduce, Float128VectorTests::MAXReduceAll);
         }
    +
         static float MAXReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2492,6 +2467,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MAXReduceFloat128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2518,6 +2494,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float128VectorTests::MAXReduceMasked, Float128VectorTests::MAXReduceAllMasked);
         }
    +
         static float FIRST_NONZEROReduce(float[] a, int idx) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2535,6 +2512,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void FIRST_NONZEROReduceFloat128VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2559,6 +2537,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float128VectorTests::FIRST_NONZEROReduce, Float128VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static float FIRST_NONZEROReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2577,6 +2556,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceFloat128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2604,10 +2584,6 @@ public class Float128VectorTests extends AbstractVectorTest {
                     Float128VectorTests::FIRST_NONZEROReduceMasked, Float128VectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void withFloat128VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2625,6 +2601,7 @@ public class Float128VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(float a) {
             return bits(a)==0;
         }
    @@ -2665,6 +2642,7 @@ public class Float128VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(float a) {
             return bits(a)<0;
         }
    @@ -2747,7 +2725,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(float a) {
             return Float.isNaN(a);
         }
    @@ -2789,7 +2766,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(float a) {
             return Float.isInfinite(a);
         }
    @@ -2831,7 +2807,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloat128VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2851,7 +2826,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloat128VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2894,7 +2868,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GTFloat128VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2937,7 +2910,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void EQFloat128VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2957,7 +2929,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void eqFloat128VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3000,7 +2971,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void NEFloat128VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3043,7 +3013,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LEFloat128VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3086,7 +3055,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GEFloat128VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3129,15 +3097,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloat128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3154,7 +3113,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3191,7 +3149,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloat128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3228,7 +3185,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3265,7 +3221,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloat128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3344,6 +3299,43 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void compressFloat128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void expandFloat128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void getFloat128VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3514,10 +3506,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ZeroFloat128VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3532,9 +3520,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static float[] sliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3560,6 +3545,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Float128VectorTests::sliceUnary);
         }
    +
         static float[] sliceBinary(float[] a, float[] b, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3589,6 +3575,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Float128VectorTests::sliceBinary);
         }
    +
         static float[] slice(float[] a, float[] b, int origin, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3622,6 +3609,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Float128VectorTests::slice);
         }
    +
         static float[] unsliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3649,6 +3637,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Float128VectorTests::unsliceUnary);
         }
    +
         static float[] unsliceBinary(float[] a, float[] b, int origin, int part, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3688,6 +3677,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Float128VectorTests::unsliceBinary);
         }
    +
         static float[] unslice(float[] a, float[] b, int origin, int part, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3768,7 +3758,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::SIN, Float128VectorTests::strictSIN);
         }
     
    -
         static float EXP(float a) {
             return (float)(Math.exp((double)a));
         }
    @@ -3792,7 +3781,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::EXP, Float128VectorTests::strictEXP);
         }
     
    -
         static float LOG1P(float a) {
             return (float)(Math.log1p((double)a));
         }
    @@ -3816,7 +3804,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::LOG1P, Float128VectorTests::strictLOG1P);
         }
     
    -
         static float LOG(float a) {
             return (float)(Math.log((double)a));
         }
    @@ -3840,7 +3827,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::LOG, Float128VectorTests::strictLOG);
         }
     
    -
         static float LOG10(float a) {
             return (float)(Math.log10((double)a));
         }
    @@ -3864,7 +3850,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::LOG10, Float128VectorTests::strictLOG10);
         }
     
    -
         static float EXPM1(float a) {
             return (float)(Math.expm1((double)a));
         }
    @@ -3888,7 +3873,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::EXPM1, Float128VectorTests::strictEXPM1);
         }
     
    -
         static float COS(float a) {
             return (float)(Math.cos((double)a));
         }
    @@ -3912,7 +3896,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::COS, Float128VectorTests::strictCOS);
         }
     
    -
         static float TAN(float a) {
             return (float)(Math.tan((double)a));
         }
    @@ -3936,7 +3919,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::TAN, Float128VectorTests::strictTAN);
         }
     
    -
         static float SINH(float a) {
             return (float)(Math.sinh((double)a));
         }
    @@ -3960,7 +3942,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::SINH, Float128VectorTests::strictSINH);
         }
     
    -
         static float COSH(float a) {
             return (float)(Math.cosh((double)a));
         }
    @@ -3984,7 +3965,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::COSH, Float128VectorTests::strictCOSH);
         }
     
    -
         static float TANH(float a) {
             return (float)(Math.tanh((double)a));
         }
    @@ -4008,7 +3988,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::TANH, Float128VectorTests::strictTANH);
         }
     
    -
         static float ASIN(float a) {
             return (float)(Math.asin((double)a));
         }
    @@ -4032,7 +4011,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::ASIN, Float128VectorTests::strictASIN);
         }
     
    -
         static float ACOS(float a) {
             return (float)(Math.acos((double)a));
         }
    @@ -4056,7 +4034,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::ACOS, Float128VectorTests::strictACOS);
         }
     
    -
         static float ATAN(float a) {
             return (float)(Math.atan((double)a));
         }
    @@ -4080,7 +4057,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::ATAN, Float128VectorTests::strictATAN);
         }
     
    -
         static float CBRT(float a) {
             return (float)(Math.cbrt((double)a));
         }
    @@ -4104,7 +4080,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::CBRT, Float128VectorTests::strictCBRT);
         }
     
    -
         static float HYPOT(float a, float b) {
             return (float)(Math.hypot((double)a, (double)b));
         }
    @@ -4131,7 +4106,6 @@ public class Float128VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float POW(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4157,6 +4131,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::POW, Float128VectorTests::strictPOW);
         }
     
    +
         static float pow(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4183,7 +4158,6 @@ public class Float128VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float ATAN2(float a, float b) {
             return (float)(Math.atan2((double)a, (double)b));
         }
    @@ -4210,7 +4184,6 @@ public class Float128VectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void POWFloat128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4225,6 +4198,7 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::POW, Float128VectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "floatBinaryOpProvider")
         static void powFloat128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4240,15 +4214,14 @@ public class Float128VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float FMA(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
    +
         static float fma(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4267,6 +4240,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Float128VectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloat128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4284,7 +4258,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Float128VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4307,10 +4280,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4341,7 +4310,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Float128VectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4380,9 +4348,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4397,6 +4362,7 @@ public class Float128VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Float128VectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloat128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4412,7 +4378,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Float128VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat128VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4431,9 +4396,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
         }
     
    -
    -
    -
         static float NEG(float a) {
             return (float)(-((float)a));
         }
    @@ -4546,13 +4508,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Float128VectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static float SQRT(float a) {
             return (float)(Math.sqrt((double)a));
         }
    @@ -4561,8 +4516,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             return (float)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void SQRTFloat128VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4593,8 +4546,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Float128VectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void SQRTMaskedFloat128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4613,7 +4564,6 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Float128VectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloat128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -5015,6 +4965,23 @@ public class Float128VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Float128VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressFloat128VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5057,6 +5024,20 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongFloat128VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5077,6 +5058,14 @@ public class Float128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongFloat128VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeFloat128VectorTestsSmokeTest() {
             FloatVector av = FloatVector.zero(SPECIES);
    @@ -5139,4 +5128,3 @@ public class Float128VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java
    index 68c6163b93e..18baffa0e90 100644
    --- a/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.FloatVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.FloatBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfFloat ELEMENT_LAYOUT = ValueLayout.JAVA_FLOAT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
     
    @@ -68,17 +70,6 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> FLOAT_GENERATORS = List.of(
                 withToString("float[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferProvider() {
    +    public Object[][] floatMemorySegmentProvider() {
             return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferMaskProvider() {
    +    public Object[][] floatMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> FLOAT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] floatByteArrayProvider() {
    -        return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] floatByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> FLOAT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] floatByteProviderForIOOBE() {
             var f = FLOAT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(float[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (float v : a) {
    -            bb.putFloat(v);
    +    static MemorySegment toSegment(float[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static float[] bufferToArray(ByteBuffer bb) {
    -        FloatBuffer db = bb.asFloatBuffer();
    -        float[] d = new float[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(float[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        FloatBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asFloatBuffer();
    -        for (float v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static float[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "floatProvider")
         static void loadStoreArray(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "floatByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "floatMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             float[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "floatByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "floatByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Float256VectorTests.java b/test/jdk/jdk/incubator/vector/Float256VectorTests.java
    index e87783e2401..13a5abb4e1f 100644
    --- a/test/jdk/jdk/incubator/vector/Float256VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Float256VectorTests.java
    @@ -60,7 +60,6 @@ public class Float256VectorTests extends AbstractVectorTest {
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
     
    -    private static final float CONST_SHIFT = Float.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
     
    @@ -261,6 +260,55 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (float)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (float)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(float[] r, float[] a, float[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1024,7 +1072,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(float e) {
             return  Float.floatToIntBits(e);
         }
    @@ -1208,7 +1255,6 @@ public class Float256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> FLOAT_COMPARE_GENERATORS = List.of(
                 withToString("float[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1329,7 +1375,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(float a, float b) {
             return a == b;
         }
    @@ -1354,7 +1399,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static float firstNonZero(float a, float b) {
             return Float.compare(a, (float) 0) != 0 ? a : b;
         }
    @@ -1471,6 +1515,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float256VectorTests::ADD);
         }
    +
         static float add(float a, float b) {
             return (float)(a + b);
         }
    @@ -1527,6 +1572,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Float256VectorTests::add);
         }
    +
         static float SUB(float a, float b) {
             return (float)(a - b);
         }
    @@ -1547,6 +1593,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float256VectorTests::SUB);
         }
    +
         static float sub(float a, float b) {
             return (float)(a - b);
         }
    @@ -1603,6 +1650,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Float256VectorTests::sub);
         }
    +
         static float MUL(float a, float b) {
             return (float)(a * b);
         }
    @@ -1623,6 +1671,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float256VectorTests::MUL);
         }
    +
         static float mul(float a, float b) {
             return (float)(a * b);
         }
    @@ -1700,6 +1749,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float256VectorTests::DIV);
         }
    +
         static float div(float a, float b) {
             return (float)(a / b);
         }
    @@ -1719,8 +1769,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Float256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void DIVFloat256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1759,8 +1807,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Float256VectorTests::div);
         }
     
    -
    -
         static float FIRST_NONZERO(float a, float b) {
             return (float)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1802,14 +1848,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Float256VectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void addFloat256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1903,7 +1941,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Float256VectorTests::mul);
         }
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void divFloat256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1918,8 +1955,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Float256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void divFloat256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1937,15 +1972,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Float256VectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void ADDFloat256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1977,63 +2003,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Float256VectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float MIN(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2054,6 +2023,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float256VectorTests::MIN);
         }
    +
         static float min(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2072,6 +2042,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float256VectorTests::min);
         }
    +
         static float MAX(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2092,6 +2063,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float256VectorTests::MAX);
         }
    +
         static float max(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2167,17 +2139,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Float256VectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float ADDReduce(float[] a, int idx) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2195,6 +2156,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ADDReduceFloat256VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2219,6 +2181,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float256VectorTests::ADDReduce, Float256VectorTests::ADDReduceAll);
         }
    +
         static float ADDReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2237,6 +2200,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void ADDReduceFloat256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2263,6 +2227,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float256VectorTests::ADDReduceMasked, Float256VectorTests::ADDReduceAllMasked);
         }
    +
         static float MULReduce(float[] a, int idx) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2280,6 +2245,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MULReduceFloat256VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2304,6 +2270,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float256VectorTests::MULReduce, Float256VectorTests::MULReduceAll);
         }
    +
         static float MULReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2322,6 +2289,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MULReduceFloat256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2348,6 +2316,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float256VectorTests::MULReduceMasked, Float256VectorTests::MULReduceAllMasked);
         }
    +
         static float MINReduce(float[] a, int idx) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2365,6 +2334,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MINReduceFloat256VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2389,6 +2359,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float256VectorTests::MINReduce, Float256VectorTests::MINReduceAll);
         }
    +
         static float MINReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2407,6 +2378,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MINReduceFloat256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2433,6 +2405,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float256VectorTests::MINReduceMasked, Float256VectorTests::MINReduceAllMasked);
         }
    +
         static float MAXReduce(float[] a, int idx) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2450,6 +2423,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MAXReduceFloat256VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2474,6 +2448,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float256VectorTests::MAXReduce, Float256VectorTests::MAXReduceAll);
         }
    +
         static float MAXReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2492,6 +2467,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MAXReduceFloat256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2518,6 +2494,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float256VectorTests::MAXReduceMasked, Float256VectorTests::MAXReduceAllMasked);
         }
    +
         static float FIRST_NONZEROReduce(float[] a, int idx) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2535,6 +2512,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void FIRST_NONZEROReduceFloat256VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2559,6 +2537,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float256VectorTests::FIRST_NONZEROReduce, Float256VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static float FIRST_NONZEROReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2577,6 +2556,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceFloat256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2604,10 +2584,6 @@ public class Float256VectorTests extends AbstractVectorTest {
                     Float256VectorTests::FIRST_NONZEROReduceMasked, Float256VectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void withFloat256VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2625,6 +2601,7 @@ public class Float256VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(float a) {
             return bits(a)==0;
         }
    @@ -2665,6 +2642,7 @@ public class Float256VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(float a) {
             return bits(a)<0;
         }
    @@ -2747,7 +2725,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(float a) {
             return Float.isNaN(a);
         }
    @@ -2789,7 +2766,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(float a) {
             return Float.isInfinite(a);
         }
    @@ -2831,7 +2807,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloat256VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2851,7 +2826,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloat256VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2894,7 +2868,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GTFloat256VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2937,7 +2910,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void EQFloat256VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2957,7 +2929,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void eqFloat256VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3000,7 +2971,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void NEFloat256VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3043,7 +3013,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LEFloat256VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3086,7 +3055,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GEFloat256VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3129,15 +3097,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloat256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3154,7 +3113,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloat256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3191,7 +3149,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloat256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3228,7 +3185,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloat256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3265,7 +3221,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloat256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3344,6 +3299,43 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void compressFloat256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void expandFloat256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void getFloat256VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3514,10 +3506,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ZeroFloat256VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3532,9 +3520,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static float[] sliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3560,6 +3545,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Float256VectorTests::sliceUnary);
         }
    +
         static float[] sliceBinary(float[] a, float[] b, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3589,6 +3575,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Float256VectorTests::sliceBinary);
         }
    +
         static float[] slice(float[] a, float[] b, int origin, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3622,6 +3609,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Float256VectorTests::slice);
         }
    +
         static float[] unsliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3649,6 +3637,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Float256VectorTests::unsliceUnary);
         }
    +
         static float[] unsliceBinary(float[] a, float[] b, int origin, int part, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3688,6 +3677,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Float256VectorTests::unsliceBinary);
         }
    +
         static float[] unslice(float[] a, float[] b, int origin, int part, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3768,7 +3758,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::SIN, Float256VectorTests::strictSIN);
         }
     
    -
         static float EXP(float a) {
             return (float)(Math.exp((double)a));
         }
    @@ -3792,7 +3781,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::EXP, Float256VectorTests::strictEXP);
         }
     
    -
         static float LOG1P(float a) {
             return (float)(Math.log1p((double)a));
         }
    @@ -3816,7 +3804,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::LOG1P, Float256VectorTests::strictLOG1P);
         }
     
    -
         static float LOG(float a) {
             return (float)(Math.log((double)a));
         }
    @@ -3840,7 +3827,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::LOG, Float256VectorTests::strictLOG);
         }
     
    -
         static float LOG10(float a) {
             return (float)(Math.log10((double)a));
         }
    @@ -3864,7 +3850,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::LOG10, Float256VectorTests::strictLOG10);
         }
     
    -
         static float EXPM1(float a) {
             return (float)(Math.expm1((double)a));
         }
    @@ -3888,7 +3873,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::EXPM1, Float256VectorTests::strictEXPM1);
         }
     
    -
         static float COS(float a) {
             return (float)(Math.cos((double)a));
         }
    @@ -3912,7 +3896,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::COS, Float256VectorTests::strictCOS);
         }
     
    -
         static float TAN(float a) {
             return (float)(Math.tan((double)a));
         }
    @@ -3936,7 +3919,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::TAN, Float256VectorTests::strictTAN);
         }
     
    -
         static float SINH(float a) {
             return (float)(Math.sinh((double)a));
         }
    @@ -3960,7 +3942,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::SINH, Float256VectorTests::strictSINH);
         }
     
    -
         static float COSH(float a) {
             return (float)(Math.cosh((double)a));
         }
    @@ -3984,7 +3965,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::COSH, Float256VectorTests::strictCOSH);
         }
     
    -
         static float TANH(float a) {
             return (float)(Math.tanh((double)a));
         }
    @@ -4008,7 +3988,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::TANH, Float256VectorTests::strictTANH);
         }
     
    -
         static float ASIN(float a) {
             return (float)(Math.asin((double)a));
         }
    @@ -4032,7 +4011,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::ASIN, Float256VectorTests::strictASIN);
         }
     
    -
         static float ACOS(float a) {
             return (float)(Math.acos((double)a));
         }
    @@ -4056,7 +4034,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::ACOS, Float256VectorTests::strictACOS);
         }
     
    -
         static float ATAN(float a) {
             return (float)(Math.atan((double)a));
         }
    @@ -4080,7 +4057,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::ATAN, Float256VectorTests::strictATAN);
         }
     
    -
         static float CBRT(float a) {
             return (float)(Math.cbrt((double)a));
         }
    @@ -4104,7 +4080,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float256VectorTests::CBRT, Float256VectorTests::strictCBRT);
         }
     
    -
         static float HYPOT(float a, float b) {
             return (float)(Math.hypot((double)a, (double)b));
         }
    @@ -4131,7 +4106,6 @@ public class Float256VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float POW(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4157,6 +4131,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, Float256VectorTests::POW, Float256VectorTests::strictPOW);
         }
     
    +
         static float pow(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4183,7 +4158,6 @@ public class Float256VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float ATAN2(float a, float b) {
             return (float)(Math.atan2((double)a, (double)b));
         }
    @@ -4210,7 +4184,6 @@ public class Float256VectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void POWFloat256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4225,6 +4198,7 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Float256VectorTests::POW, Float256VectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "floatBinaryOpProvider")
         static void powFloat256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4240,15 +4214,14 @@ public class Float256VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float FMA(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
    +
         static float fma(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4267,6 +4240,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Float256VectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloat256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4284,7 +4258,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Float256VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4307,10 +4280,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Float256VectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4341,7 +4310,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Float256VectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4380,9 +4348,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Float256VectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4397,6 +4362,7 @@ public class Float256VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Float256VectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloat256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4412,7 +4378,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Float256VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat256VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4431,9 +4396,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Float256VectorTests::FMA);
         }
     
    -
    -
    -
         static float NEG(float a) {
             return (float)(-((float)a));
         }
    @@ -4546,13 +4508,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Float256VectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static float SQRT(float a) {
             return (float)(Math.sqrt((double)a));
         }
    @@ -4561,8 +4516,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             return (float)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void SQRTFloat256VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4593,8 +4546,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Float256VectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void SQRTMaskedFloat256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4613,7 +4564,6 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Float256VectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloat256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -5015,6 +4965,23 @@ public class Float256VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Float256VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressFloat256VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5057,6 +5024,20 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongFloat256VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5077,6 +5058,14 @@ public class Float256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongFloat256VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeFloat256VectorTestsSmokeTest() {
             FloatVector av = FloatVector.zero(SPECIES);
    @@ -5139,4 +5128,3 @@ public class Float256VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java
    index dacc8ebb7e3..d1ba7a644de 100644
    --- a/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.FloatVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.FloatBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfFloat ELEMENT_LAYOUT = ValueLayout.JAVA_FLOAT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
     
    @@ -68,17 +70,6 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> FLOAT_GENERATORS = List.of(
                 withToString("float[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferProvider() {
    +    public Object[][] floatMemorySegmentProvider() {
             return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferMaskProvider() {
    +    public Object[][] floatMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> FLOAT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] floatByteArrayProvider() {
    -        return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] floatByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> FLOAT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] floatByteProviderForIOOBE() {
             var f = FLOAT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(float[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (float v : a) {
    -            bb.putFloat(v);
    +    static MemorySegment toSegment(float[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static float[] bufferToArray(ByteBuffer bb) {
    -        FloatBuffer db = bb.asFloatBuffer();
    -        float[] d = new float[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(float[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        FloatBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asFloatBuffer();
    -        for (float v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static float[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "floatProvider")
         static void loadStoreArray(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "floatByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "floatMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             float[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "floatByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "floatByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Float512VectorTests.java b/test/jdk/jdk/incubator/vector/Float512VectorTests.java
    index 815b8049a1e..650c62f2661 100644
    --- a/test/jdk/jdk/incubator/vector/Float512VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Float512VectorTests.java
    @@ -60,7 +60,6 @@ public class Float512VectorTests extends AbstractVectorTest {
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
     
    -    private static final float CONST_SHIFT = Float.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
     
    @@ -261,6 +260,55 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (float)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (float)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(float[] r, float[] a, float[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1024,7 +1072,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(float e) {
             return  Float.floatToIntBits(e);
         }
    @@ -1208,7 +1255,6 @@ public class Float512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> FLOAT_COMPARE_GENERATORS = List.of(
                 withToString("float[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1329,7 +1375,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(float a, float b) {
             return a == b;
         }
    @@ -1354,7 +1399,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static float firstNonZero(float a, float b) {
             return Float.compare(a, (float) 0) != 0 ? a : b;
         }
    @@ -1471,6 +1515,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float512VectorTests::ADD);
         }
    +
         static float add(float a, float b) {
             return (float)(a + b);
         }
    @@ -1527,6 +1572,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Float512VectorTests::add);
         }
    +
         static float SUB(float a, float b) {
             return (float)(a - b);
         }
    @@ -1547,6 +1593,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float512VectorTests::SUB);
         }
    +
         static float sub(float a, float b) {
             return (float)(a - b);
         }
    @@ -1603,6 +1650,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Float512VectorTests::sub);
         }
    +
         static float MUL(float a, float b) {
             return (float)(a * b);
         }
    @@ -1623,6 +1671,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float512VectorTests::MUL);
         }
    +
         static float mul(float a, float b) {
             return (float)(a * b);
         }
    @@ -1700,6 +1749,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float512VectorTests::DIV);
         }
    +
         static float div(float a, float b) {
             return (float)(a / b);
         }
    @@ -1719,8 +1769,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Float512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void DIVFloat512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1759,8 +1807,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Float512VectorTests::div);
         }
     
    -
    -
         static float FIRST_NONZERO(float a, float b) {
             return (float)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1802,14 +1848,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Float512VectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void addFloat512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1903,7 +1941,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Float512VectorTests::mul);
         }
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void divFloat512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1918,8 +1955,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Float512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void divFloat512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1937,15 +1972,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Float512VectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void ADDFloat512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1977,63 +2003,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Float512VectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float MIN(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2054,6 +2023,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float512VectorTests::MIN);
         }
    +
         static float min(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2072,6 +2042,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float512VectorTests::min);
         }
    +
         static float MAX(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2092,6 +2063,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float512VectorTests::MAX);
         }
    +
         static float max(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2167,17 +2139,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Float512VectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float ADDReduce(float[] a, int idx) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2195,6 +2156,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ADDReduceFloat512VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2219,6 +2181,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float512VectorTests::ADDReduce, Float512VectorTests::ADDReduceAll);
         }
    +
         static float ADDReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2237,6 +2200,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void ADDReduceFloat512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2263,6 +2227,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float512VectorTests::ADDReduceMasked, Float512VectorTests::ADDReduceAllMasked);
         }
    +
         static float MULReduce(float[] a, int idx) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2280,6 +2245,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MULReduceFloat512VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2304,6 +2270,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float512VectorTests::MULReduce, Float512VectorTests::MULReduceAll);
         }
    +
         static float MULReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2322,6 +2289,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MULReduceFloat512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2348,6 +2316,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float512VectorTests::MULReduceMasked, Float512VectorTests::MULReduceAllMasked);
         }
    +
         static float MINReduce(float[] a, int idx) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2365,6 +2334,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MINReduceFloat512VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2389,6 +2359,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float512VectorTests::MINReduce, Float512VectorTests::MINReduceAll);
         }
    +
         static float MINReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2407,6 +2378,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MINReduceFloat512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2433,6 +2405,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float512VectorTests::MINReduceMasked, Float512VectorTests::MINReduceAllMasked);
         }
    +
         static float MAXReduce(float[] a, int idx) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2450,6 +2423,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MAXReduceFloat512VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2474,6 +2448,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float512VectorTests::MAXReduce, Float512VectorTests::MAXReduceAll);
         }
    +
         static float MAXReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2492,6 +2467,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MAXReduceFloat512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2518,6 +2494,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float512VectorTests::MAXReduceMasked, Float512VectorTests::MAXReduceAllMasked);
         }
    +
         static float FIRST_NONZEROReduce(float[] a, int idx) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2535,6 +2512,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void FIRST_NONZEROReduceFloat512VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2559,6 +2537,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float512VectorTests::FIRST_NONZEROReduce, Float512VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static float FIRST_NONZEROReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2577,6 +2556,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceFloat512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2604,10 +2584,6 @@ public class Float512VectorTests extends AbstractVectorTest {
                     Float512VectorTests::FIRST_NONZEROReduceMasked, Float512VectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void withFloat512VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2625,6 +2601,7 @@ public class Float512VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(float a) {
             return bits(a)==0;
         }
    @@ -2665,6 +2642,7 @@ public class Float512VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(float a) {
             return bits(a)<0;
         }
    @@ -2747,7 +2725,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(float a) {
             return Float.isNaN(a);
         }
    @@ -2789,7 +2766,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(float a) {
             return Float.isInfinite(a);
         }
    @@ -2831,7 +2807,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloat512VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2851,7 +2826,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloat512VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2894,7 +2868,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GTFloat512VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2937,7 +2910,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void EQFloat512VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2957,7 +2929,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void eqFloat512VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3000,7 +2971,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void NEFloat512VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3043,7 +3013,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LEFloat512VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3086,7 +3055,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GEFloat512VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3129,15 +3097,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloat512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3154,7 +3113,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloat512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3191,7 +3149,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloat512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3228,7 +3185,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloat512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3265,7 +3221,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloat512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3344,6 +3299,43 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void compressFloat512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void expandFloat512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void getFloat512VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3514,10 +3506,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ZeroFloat512VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3532,9 +3520,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static float[] sliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3560,6 +3545,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Float512VectorTests::sliceUnary);
         }
    +
         static float[] sliceBinary(float[] a, float[] b, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3589,6 +3575,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Float512VectorTests::sliceBinary);
         }
    +
         static float[] slice(float[] a, float[] b, int origin, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3622,6 +3609,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Float512VectorTests::slice);
         }
    +
         static float[] unsliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3649,6 +3637,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Float512VectorTests::unsliceUnary);
         }
    +
         static float[] unsliceBinary(float[] a, float[] b, int origin, int part, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3688,6 +3677,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Float512VectorTests::unsliceBinary);
         }
    +
         static float[] unslice(float[] a, float[] b, int origin, int part, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3768,7 +3758,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::SIN, Float512VectorTests::strictSIN);
         }
     
    -
         static float EXP(float a) {
             return (float)(Math.exp((double)a));
         }
    @@ -3792,7 +3781,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::EXP, Float512VectorTests::strictEXP);
         }
     
    -
         static float LOG1P(float a) {
             return (float)(Math.log1p((double)a));
         }
    @@ -3816,7 +3804,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::LOG1P, Float512VectorTests::strictLOG1P);
         }
     
    -
         static float LOG(float a) {
             return (float)(Math.log((double)a));
         }
    @@ -3840,7 +3827,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::LOG, Float512VectorTests::strictLOG);
         }
     
    -
         static float LOG10(float a) {
             return (float)(Math.log10((double)a));
         }
    @@ -3864,7 +3850,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::LOG10, Float512VectorTests::strictLOG10);
         }
     
    -
         static float EXPM1(float a) {
             return (float)(Math.expm1((double)a));
         }
    @@ -3888,7 +3873,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::EXPM1, Float512VectorTests::strictEXPM1);
         }
     
    -
         static float COS(float a) {
             return (float)(Math.cos((double)a));
         }
    @@ -3912,7 +3896,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::COS, Float512VectorTests::strictCOS);
         }
     
    -
         static float TAN(float a) {
             return (float)(Math.tan((double)a));
         }
    @@ -3936,7 +3919,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::TAN, Float512VectorTests::strictTAN);
         }
     
    -
         static float SINH(float a) {
             return (float)(Math.sinh((double)a));
         }
    @@ -3960,7 +3942,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::SINH, Float512VectorTests::strictSINH);
         }
     
    -
         static float COSH(float a) {
             return (float)(Math.cosh((double)a));
         }
    @@ -3984,7 +3965,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::COSH, Float512VectorTests::strictCOSH);
         }
     
    -
         static float TANH(float a) {
             return (float)(Math.tanh((double)a));
         }
    @@ -4008,7 +3988,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::TANH, Float512VectorTests::strictTANH);
         }
     
    -
         static float ASIN(float a) {
             return (float)(Math.asin((double)a));
         }
    @@ -4032,7 +4011,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::ASIN, Float512VectorTests::strictASIN);
         }
     
    -
         static float ACOS(float a) {
             return (float)(Math.acos((double)a));
         }
    @@ -4056,7 +4034,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::ACOS, Float512VectorTests::strictACOS);
         }
     
    -
         static float ATAN(float a) {
             return (float)(Math.atan((double)a));
         }
    @@ -4080,7 +4057,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::ATAN, Float512VectorTests::strictATAN);
         }
     
    -
         static float CBRT(float a) {
             return (float)(Math.cbrt((double)a));
         }
    @@ -4104,7 +4080,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float512VectorTests::CBRT, Float512VectorTests::strictCBRT);
         }
     
    -
         static float HYPOT(float a, float b) {
             return (float)(Math.hypot((double)a, (double)b));
         }
    @@ -4131,7 +4106,6 @@ public class Float512VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float POW(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4157,6 +4131,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, Float512VectorTests::POW, Float512VectorTests::strictPOW);
         }
     
    +
         static float pow(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4183,7 +4158,6 @@ public class Float512VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float ATAN2(float a, float b) {
             return (float)(Math.atan2((double)a, (double)b));
         }
    @@ -4210,7 +4184,6 @@ public class Float512VectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void POWFloat512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4225,6 +4198,7 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Float512VectorTests::POW, Float512VectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "floatBinaryOpProvider")
         static void powFloat512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4240,15 +4214,14 @@ public class Float512VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float FMA(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
    +
         static float fma(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4267,6 +4240,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Float512VectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloat512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4284,7 +4258,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Float512VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4307,10 +4280,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Float512VectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4341,7 +4310,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Float512VectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4380,9 +4348,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Float512VectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4397,6 +4362,7 @@ public class Float512VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Float512VectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloat512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4412,7 +4378,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Float512VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat512VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4431,9 +4396,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Float512VectorTests::FMA);
         }
     
    -
    -
    -
         static float NEG(float a) {
             return (float)(-((float)a));
         }
    @@ -4546,13 +4508,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Float512VectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static float SQRT(float a) {
             return (float)(Math.sqrt((double)a));
         }
    @@ -4561,8 +4516,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             return (float)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void SQRTFloat512VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4593,8 +4546,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Float512VectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void SQRTMaskedFloat512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4613,7 +4564,6 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Float512VectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloat512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -5015,6 +4965,23 @@ public class Float512VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Float512VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressFloat512VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5057,6 +5024,20 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongFloat512VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5077,6 +5058,14 @@ public class Float512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongFloat512VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeFloat512VectorTestsSmokeTest() {
             FloatVector av = FloatVector.zero(SPECIES);
    @@ -5139,4 +5128,3 @@ public class Float512VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java
    index e2923d46abc..83ecf751cb5 100644
    --- a/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.FloatVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.FloatBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfFloat ELEMENT_LAYOUT = ValueLayout.JAVA_FLOAT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
     
    @@ -68,17 +70,6 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> FLOAT_GENERATORS = List.of(
                 withToString("float[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferProvider() {
    +    public Object[][] floatMemorySegmentProvider() {
             return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferMaskProvider() {
    +    public Object[][] floatMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> FLOAT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] floatByteArrayProvider() {
    -        return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] floatByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> FLOAT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] floatByteProviderForIOOBE() {
             var f = FLOAT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(float[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (float v : a) {
    -            bb.putFloat(v);
    +    static MemorySegment toSegment(float[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static float[] bufferToArray(ByteBuffer bb) {
    -        FloatBuffer db = bb.asFloatBuffer();
    -        float[] d = new float[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(float[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        FloatBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asFloatBuffer();
    -        for (float v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static float[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "floatProvider")
         static void loadStoreArray(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "floatByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "floatMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             float[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "floatByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "floatByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Float64VectorTests.java b/test/jdk/jdk/incubator/vector/Float64VectorTests.java
    index e7468ba8d14..bbaa3f1e000 100644
    --- a/test/jdk/jdk/incubator/vector/Float64VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Float64VectorTests.java
    @@ -60,7 +60,6 @@ public class Float64VectorTests extends AbstractVectorTest {
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
     
    -    private static final float CONST_SHIFT = Float.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
     
    @@ -261,6 +260,55 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (float)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (float)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(float[] r, float[] a, float[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1024,7 +1072,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(float e) {
             return  Float.floatToIntBits(e);
         }
    @@ -1208,7 +1255,6 @@ public class Float64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> FLOAT_COMPARE_GENERATORS = List.of(
                 withToString("float[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1329,7 +1375,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(float a, float b) {
             return a == b;
         }
    @@ -1354,7 +1399,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static float firstNonZero(float a, float b) {
             return Float.compare(a, (float) 0) != 0 ? a : b;
         }
    @@ -1471,6 +1515,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float64VectorTests::ADD);
         }
    +
         static float add(float a, float b) {
             return (float)(a + b);
         }
    @@ -1527,6 +1572,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Float64VectorTests::add);
         }
    +
         static float SUB(float a, float b) {
             return (float)(a - b);
         }
    @@ -1547,6 +1593,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float64VectorTests::SUB);
         }
    +
         static float sub(float a, float b) {
             return (float)(a - b);
         }
    @@ -1603,6 +1650,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Float64VectorTests::sub);
         }
    +
         static float MUL(float a, float b) {
             return (float)(a * b);
         }
    @@ -1623,6 +1671,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float64VectorTests::MUL);
         }
    +
         static float mul(float a, float b) {
             return (float)(a * b);
         }
    @@ -1700,6 +1749,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float64VectorTests::DIV);
         }
    +
         static float div(float a, float b) {
             return (float)(a / b);
         }
    @@ -1719,8 +1769,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Float64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void DIVFloat64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1759,8 +1807,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Float64VectorTests::div);
         }
     
    -
    -
         static float FIRST_NONZERO(float a, float b) {
             return (float)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1802,14 +1848,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Float64VectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void addFloat64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1903,7 +1941,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Float64VectorTests::mul);
         }
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void divFloat64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1918,8 +1955,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Float64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void divFloat64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1937,15 +1972,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Float64VectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void ADDFloat64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1977,63 +2003,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Float64VectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float MIN(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2054,6 +2023,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float64VectorTests::MIN);
         }
    +
         static float min(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2072,6 +2042,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float64VectorTests::min);
         }
    +
         static float MAX(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2092,6 +2063,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Float64VectorTests::MAX);
         }
    +
         static float max(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2167,17 +2139,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Float64VectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float ADDReduce(float[] a, int idx) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2195,6 +2156,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ADDReduceFloat64VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2219,6 +2181,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float64VectorTests::ADDReduce, Float64VectorTests::ADDReduceAll);
         }
    +
         static float ADDReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2237,6 +2200,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void ADDReduceFloat64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2263,6 +2227,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float64VectorTests::ADDReduceMasked, Float64VectorTests::ADDReduceAllMasked);
         }
    +
         static float MULReduce(float[] a, int idx) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2280,6 +2245,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MULReduceFloat64VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2304,6 +2270,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float64VectorTests::MULReduce, Float64VectorTests::MULReduceAll);
         }
    +
         static float MULReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2322,6 +2289,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MULReduceFloat64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2348,6 +2316,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float64VectorTests::MULReduceMasked, Float64VectorTests::MULReduceAllMasked);
         }
    +
         static float MINReduce(float[] a, int idx) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2365,6 +2334,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MINReduceFloat64VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2389,6 +2359,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float64VectorTests::MINReduce, Float64VectorTests::MINReduceAll);
         }
    +
         static float MINReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2407,6 +2378,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MINReduceFloat64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2433,6 +2405,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float64VectorTests::MINReduceMasked, Float64VectorTests::MINReduceAllMasked);
         }
    +
         static float MAXReduce(float[] a, int idx) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2450,6 +2423,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MAXReduceFloat64VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2474,6 +2448,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float64VectorTests::MAXReduce, Float64VectorTests::MAXReduceAll);
         }
    +
         static float MAXReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2492,6 +2467,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MAXReduceFloat64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2518,6 +2494,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Float64VectorTests::MAXReduceMasked, Float64VectorTests::MAXReduceAllMasked);
         }
    +
         static float FIRST_NONZEROReduce(float[] a, int idx) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2535,6 +2512,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void FIRST_NONZEROReduceFloat64VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2559,6 +2537,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Float64VectorTests::FIRST_NONZEROReduce, Float64VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static float FIRST_NONZEROReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2577,6 +2556,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceFloat64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2604,10 +2584,6 @@ public class Float64VectorTests extends AbstractVectorTest {
                     Float64VectorTests::FIRST_NONZEROReduceMasked, Float64VectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void withFloat64VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2625,6 +2601,7 @@ public class Float64VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(float a) {
             return bits(a)==0;
         }
    @@ -2665,6 +2642,7 @@ public class Float64VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(float a) {
             return bits(a)<0;
         }
    @@ -2747,7 +2725,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(float a) {
             return Float.isNaN(a);
         }
    @@ -2789,7 +2766,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(float a) {
             return Float.isInfinite(a);
         }
    @@ -2831,7 +2807,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloat64VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2851,7 +2826,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloat64VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2894,7 +2868,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GTFloat64VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2937,7 +2910,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void EQFloat64VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2957,7 +2929,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void eqFloat64VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3000,7 +2971,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void NEFloat64VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3043,7 +3013,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LEFloat64VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3086,7 +3055,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GEFloat64VectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3129,15 +3097,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloat64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3154,7 +3113,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloat64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3191,7 +3149,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloat64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3228,7 +3185,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloat64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3265,7 +3221,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloat64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3344,6 +3299,43 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void compressFloat64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void expandFloat64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void getFloat64VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3514,10 +3506,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ZeroFloat64VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3532,9 +3520,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static float[] sliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3560,6 +3545,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Float64VectorTests::sliceUnary);
         }
    +
         static float[] sliceBinary(float[] a, float[] b, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3589,6 +3575,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Float64VectorTests::sliceBinary);
         }
    +
         static float[] slice(float[] a, float[] b, int origin, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3622,6 +3609,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Float64VectorTests::slice);
         }
    +
         static float[] unsliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3649,6 +3637,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Float64VectorTests::unsliceUnary);
         }
    +
         static float[] unsliceBinary(float[] a, float[] b, int origin, int part, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3688,6 +3677,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Float64VectorTests::unsliceBinary);
         }
    +
         static float[] unslice(float[] a, float[] b, int origin, int part, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3768,7 +3758,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::SIN, Float64VectorTests::strictSIN);
         }
     
    -
         static float EXP(float a) {
             return (float)(Math.exp((double)a));
         }
    @@ -3792,7 +3781,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::EXP, Float64VectorTests::strictEXP);
         }
     
    -
         static float LOG1P(float a) {
             return (float)(Math.log1p((double)a));
         }
    @@ -3816,7 +3804,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::LOG1P, Float64VectorTests::strictLOG1P);
         }
     
    -
         static float LOG(float a) {
             return (float)(Math.log((double)a));
         }
    @@ -3840,7 +3827,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::LOG, Float64VectorTests::strictLOG);
         }
     
    -
         static float LOG10(float a) {
             return (float)(Math.log10((double)a));
         }
    @@ -3864,7 +3850,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::LOG10, Float64VectorTests::strictLOG10);
         }
     
    -
         static float EXPM1(float a) {
             return (float)(Math.expm1((double)a));
         }
    @@ -3888,7 +3873,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::EXPM1, Float64VectorTests::strictEXPM1);
         }
     
    -
         static float COS(float a) {
             return (float)(Math.cos((double)a));
         }
    @@ -3912,7 +3896,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::COS, Float64VectorTests::strictCOS);
         }
     
    -
         static float TAN(float a) {
             return (float)(Math.tan((double)a));
         }
    @@ -3936,7 +3919,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::TAN, Float64VectorTests::strictTAN);
         }
     
    -
         static float SINH(float a) {
             return (float)(Math.sinh((double)a));
         }
    @@ -3960,7 +3942,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::SINH, Float64VectorTests::strictSINH);
         }
     
    -
         static float COSH(float a) {
             return (float)(Math.cosh((double)a));
         }
    @@ -3984,7 +3965,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::COSH, Float64VectorTests::strictCOSH);
         }
     
    -
         static float TANH(float a) {
             return (float)(Math.tanh((double)a));
         }
    @@ -4008,7 +3988,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::TANH, Float64VectorTests::strictTANH);
         }
     
    -
         static float ASIN(float a) {
             return (float)(Math.asin((double)a));
         }
    @@ -4032,7 +4011,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::ASIN, Float64VectorTests::strictASIN);
         }
     
    -
         static float ACOS(float a) {
             return (float)(Math.acos((double)a));
         }
    @@ -4056,7 +4034,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::ACOS, Float64VectorTests::strictACOS);
         }
     
    -
         static float ATAN(float a) {
             return (float)(Math.atan((double)a));
         }
    @@ -4080,7 +4057,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::ATAN, Float64VectorTests::strictATAN);
         }
     
    -
         static float CBRT(float a) {
             return (float)(Math.cbrt((double)a));
         }
    @@ -4104,7 +4080,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, Float64VectorTests::CBRT, Float64VectorTests::strictCBRT);
         }
     
    -
         static float HYPOT(float a, float b) {
             return (float)(Math.hypot((double)a, (double)b));
         }
    @@ -4131,7 +4106,6 @@ public class Float64VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float POW(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4157,6 +4131,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, Float64VectorTests::POW, Float64VectorTests::strictPOW);
         }
     
    +
         static float pow(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4183,7 +4158,6 @@ public class Float64VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float ATAN2(float a, float b) {
             return (float)(Math.atan2((double)a, (double)b));
         }
    @@ -4210,7 +4184,6 @@ public class Float64VectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void POWFloat64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4225,6 +4198,7 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Float64VectorTests::POW, Float64VectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "floatBinaryOpProvider")
         static void powFloat64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4240,15 +4214,14 @@ public class Float64VectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float FMA(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
    +
         static float fma(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4267,6 +4240,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Float64VectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloat64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4284,7 +4258,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Float64VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4307,10 +4280,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Float64VectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4341,7 +4310,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Float64VectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4380,9 +4348,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Float64VectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloat64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4397,6 +4362,7 @@ public class Float64VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Float64VectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloat64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4412,7 +4378,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Float64VectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloat64VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4431,9 +4396,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Float64VectorTests::FMA);
         }
     
    -
    -
    -
         static float NEG(float a) {
             return (float)(-((float)a));
         }
    @@ -4546,13 +4508,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Float64VectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static float SQRT(float a) {
             return (float)(Math.sqrt((double)a));
         }
    @@ -4561,8 +4516,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             return (float)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void SQRTFloat64VectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4593,8 +4546,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Float64VectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void SQRTMaskedFloat64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4613,7 +4564,6 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Float64VectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloat64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -5015,6 +4965,23 @@ public class Float64VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Float64VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressFloat64VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5057,6 +5024,20 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongFloat64VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5077,6 +5058,14 @@ public class Float64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongFloat64VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeFloat64VectorTestsSmokeTest() {
             FloatVector av = FloatVector.zero(SPECIES);
    @@ -5139,4 +5128,3 @@ public class Float64VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java
    index db17cbeb62d..64148eaabdb 100644
    --- a/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java
    @@ -32,6 +32,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.FloatVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorShape;
    @@ -42,12 +45,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.lang.invoke.MethodHandles;
    -import java.lang.invoke.VarHandle;
    -import java.nio.ByteBuffer;
    -import java.nio.FloatBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -58,6 +56,8 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfFloat ELEMENT_LAYOUT = ValueLayout.JAVA_FLOAT.withBitAlignment(8);
    +
         static VectorShape getMaxBit() {
             return VectorShape.S_Max_BIT;
         }
    @@ -77,17 +77,6 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> FLOAT_GENERATORS = List.of(
                 withToString("float[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -127,7 +116,7 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -198,9 +187,9 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferProvider() {
    +    public Object[][] floatMemorySegmentProvider() {
             return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -208,35 +197,16 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] floatByteBufferMaskProvider() {
    +    public Object[][] floatMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> FLOAT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] floatByteArrayProvider() {
    -        return FLOAT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] floatByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> FLOAT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] floatByteProviderForIOOBE() {
             var f = FLOAT_GENERATORS.get(0);
    @@ -256,28 +226,16 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(float[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (float v : a) {
    -            bb.putFloat(v);
    +    static MemorySegment toSegment(float[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static float[] bufferToArray(ByteBuffer bb) {
    -        FloatBuffer db = bb.asFloatBuffer();
    -        float[] d = new float[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(float[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        FloatBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asFloatBuffer();
    -        for (float v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static float[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -317,46 +275,25 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static FloatVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static FloatVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return FloatVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(FloatVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(FloatVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static FloatVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return FloatVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(FloatVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "floatProvider")
         static void loadStoreArray(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -527,48 +464,45 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -580,25 +514,25 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -609,70 +543,61 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "floatByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "floatMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             float[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                FloatVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -684,27 +609,27 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Float.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Float.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            FloatVector av = FloatVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            FloatVector av = FloatVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -715,214 +640,36 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "floatMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "floatByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "floatByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "floatByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "floatByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                FloatVector av = FloatVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            FloatVector av = FloatVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -937,6 +684,7 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java b/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java
    index 234f4b23991..80dc6df67a6 100644
    --- a/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java
    @@ -65,7 +65,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
         private static final int Max = 256;  // juts so we can do N/Max
     
    -    private static final float CONST_SHIFT = Float.SIZE / 2;
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max);
     
    @@ -266,6 +265,55 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (float)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(float[] r, float[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (float)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (float)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(float[] r, float[] a, float[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1029,7 +1077,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(float e) {
             return  Float.floatToIntBits(e);
         }
    @@ -1213,7 +1260,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> FLOAT_COMPARE_GENERATORS = List.of(
                 withToString("float[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1334,7 +1380,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             return new long[length];
         };
     
    -
         static boolean eq(float a, float b) {
             return a == b;
         }
    @@ -1359,7 +1404,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             return a >= b;
         }
     
    -
         static float firstNonZero(float a, float b) {
             return Float.compare(a, (float) 0) != 0 ? a : b;
         }
    @@ -1476,6 +1520,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, FloatMaxVectorTests::ADD);
         }
    +
         static float add(float a, float b) {
             return (float)(a + b);
         }
    @@ -1532,6 +1577,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::add);
         }
    +
         static float SUB(float a, float b) {
             return (float)(a - b);
         }
    @@ -1552,6 +1598,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, FloatMaxVectorTests::SUB);
         }
    +
         static float sub(float a, float b) {
             return (float)(a - b);
         }
    @@ -1608,6 +1655,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::sub);
         }
    +
         static float MUL(float a, float b) {
             return (float)(a * b);
         }
    @@ -1628,6 +1676,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, FloatMaxVectorTests::MUL);
         }
    +
         static float mul(float a, float b) {
             return (float)(a * b);
         }
    @@ -1705,6 +1754,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, FloatMaxVectorTests::DIV);
         }
    +
         static float div(float a, float b) {
             return (float)(a / b);
         }
    @@ -1724,8 +1774,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, FloatMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void DIVFloatMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1764,8 +1812,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::div);
         }
     
    -
    -
         static float FIRST_NONZERO(float a, float b) {
             return (float)(Double.doubleToLongBits(a)!=0?a:b);
         }
    @@ -1807,14 +1853,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, FloatMaxVectorTests::FIRST_NONZERO);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void addFloatMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1908,7 +1946,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, FloatMaxVectorTests::mul);
         }
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void divFloatMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1923,8 +1960,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "floatBinaryOpMaskProvider")
         static void divFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1942,15 +1977,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, FloatMaxVectorTests::div);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void ADDFloatMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -1982,63 +2008,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, FloatMaxVectorTests::ADD);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float MIN(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2059,6 +2028,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, FloatMaxVectorTests::MIN);
         }
    +
         static float min(float a, float b) {
             return (float)(Math.min(a, b));
         }
    @@ -2077,6 +2047,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, FloatMaxVectorTests::min);
         }
    +
         static float MAX(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2097,6 +2068,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, FloatMaxVectorTests::MAX);
         }
    +
         static float max(float a, float b) {
             return (float)(Math.max(a, b));
         }
    @@ -2172,17 +2144,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, FloatMaxVectorTests::max);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static float ADDReduce(float[] a, int idx) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2200,6 +2161,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ADDReduceFloatMaxVectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2224,6 +2186,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     FloatMaxVectorTests::ADDReduce, FloatMaxVectorTests::ADDReduceAll);
         }
    +
         static float ADDReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2242,6 +2205,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void ADDReduceFloatMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2268,6 +2232,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     FloatMaxVectorTests::ADDReduceMasked, FloatMaxVectorTests::ADDReduceAllMasked);
         }
    +
         static float MULReduce(float[] a, int idx) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2285,6 +2250,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MULReduceFloatMaxVectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2309,6 +2275,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     FloatMaxVectorTests::MULReduce, FloatMaxVectorTests::MULReduceAll);
         }
    +
         static float MULReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2327,6 +2294,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MULReduceFloatMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2353,6 +2321,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     FloatMaxVectorTests::MULReduceMasked, FloatMaxVectorTests::MULReduceAllMasked);
         }
    +
         static float MINReduce(float[] a, int idx) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2370,6 +2339,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MINReduceFloatMaxVectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2394,6 +2364,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     FloatMaxVectorTests::MINReduce, FloatMaxVectorTests::MINReduceAll);
         }
    +
         static float MINReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.POSITIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2412,6 +2383,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MINReduceFloatMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2438,6 +2410,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     FloatMaxVectorTests::MINReduceMasked, FloatMaxVectorTests::MINReduceAllMasked);
         }
    +
         static float MAXReduce(float[] a, int idx) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2455,6 +2428,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void MAXReduceFloatMaxVectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2479,6 +2453,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     FloatMaxVectorTests::MAXReduce, FloatMaxVectorTests::MAXReduceAll);
         }
    +
         static float MAXReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = Float.NEGATIVE_INFINITY;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2497,6 +2472,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void MAXReduceFloatMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2523,6 +2499,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     FloatMaxVectorTests::MAXReduceMasked, FloatMaxVectorTests::MAXReduceAllMasked);
         }
    +
         static float FIRST_NONZEROReduce(float[] a, int idx) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2540,6 +2517,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void FIRST_NONZEROReduceFloatMaxVectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2564,6 +2542,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     FloatMaxVectorTests::FIRST_NONZEROReduce, FloatMaxVectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static float FIRST_NONZEROReduceMasked(float[] a, int idx, boolean[] mask) {
             float res = (float) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -2582,6 +2561,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceFloatMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2609,10 +2589,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
                     FloatMaxVectorTests::FIRST_NONZEROReduceMasked, FloatMaxVectorTests::FIRST_NONZEROReduceAllMasked);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void withFloatMaxVectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2630,6 +2606,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(float a) {
             return bits(a)==0;
         }
    @@ -2670,6 +2647,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(float a) {
             return bits(a)<0;
         }
    @@ -2752,7 +2730,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_NAN(float a) {
             return Float.isNaN(a);
         }
    @@ -2794,7 +2771,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static boolean testIS_INFINITE(float a) {
             return Float.isInfinite(a);
         }
    @@ -2836,7 +2812,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloatMaxVectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2856,7 +2831,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloatMaxVectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2899,7 +2873,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GTFloatMaxVectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2942,7 +2915,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void EQFloatMaxVectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -2962,7 +2934,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void eqFloatMaxVectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3005,7 +2976,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void NEFloatMaxVectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3048,7 +3018,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LEFloatMaxVectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3091,7 +3060,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void GEFloatMaxVectorTests(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3134,15 +3102,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void LTFloatMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3159,7 +3118,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3196,7 +3154,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void LTFloatMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3233,7 +3190,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3270,7 +3226,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "floatCompareOpMaskProvider")
         static void EQFloatMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -3349,6 +3304,43 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void compressFloatMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "floatUnaryOpMaskProvider")
    +    static void expandFloatMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        float[] a = fa.apply(SPECIES.length());
    +        float[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                FloatVector av = FloatVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "floatUnaryOpProvider")
         static void getFloatMaxVectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3519,10 +3511,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void ZeroFloatMaxVectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -3537,9 +3525,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static float[] sliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -3565,6 +3550,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, FloatMaxVectorTests::sliceUnary);
         }
    +
         static float[] sliceBinary(float[] a, float[] b, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3594,6 +3580,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, FloatMaxVectorTests::sliceBinary);
         }
    +
         static float[] slice(float[] a, float[] b, int origin, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3627,6 +3614,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, FloatMaxVectorTests::slice);
         }
    +
         static float[] unsliceUnary(float[] a, int origin, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3654,6 +3642,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, FloatMaxVectorTests::unsliceUnary);
         }
    +
         static float[] unsliceBinary(float[] a, float[] b, int origin, int part, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3693,6 +3682,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, FloatMaxVectorTests::unsliceBinary);
         }
    +
         static float[] unslice(float[] a, float[] b, int origin, int part, boolean[] mask, int idx) {
             float[] res = new float[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -3773,7 +3763,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::SIN, FloatMaxVectorTests::strictSIN);
         }
     
    -
         static float EXP(float a) {
             return (float)(Math.exp((double)a));
         }
    @@ -3797,7 +3786,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::EXP, FloatMaxVectorTests::strictEXP);
         }
     
    -
         static float LOG1P(float a) {
             return (float)(Math.log1p((double)a));
         }
    @@ -3821,7 +3809,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::LOG1P, FloatMaxVectorTests::strictLOG1P);
         }
     
    -
         static float LOG(float a) {
             return (float)(Math.log((double)a));
         }
    @@ -3845,7 +3832,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::LOG, FloatMaxVectorTests::strictLOG);
         }
     
    -
         static float LOG10(float a) {
             return (float)(Math.log10((double)a));
         }
    @@ -3869,7 +3855,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::LOG10, FloatMaxVectorTests::strictLOG10);
         }
     
    -
         static float EXPM1(float a) {
             return (float)(Math.expm1((double)a));
         }
    @@ -3893,7 +3878,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::EXPM1, FloatMaxVectorTests::strictEXPM1);
         }
     
    -
         static float COS(float a) {
             return (float)(Math.cos((double)a));
         }
    @@ -3917,7 +3901,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::COS, FloatMaxVectorTests::strictCOS);
         }
     
    -
         static float TAN(float a) {
             return (float)(Math.tan((double)a));
         }
    @@ -3941,7 +3924,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::TAN, FloatMaxVectorTests::strictTAN);
         }
     
    -
         static float SINH(float a) {
             return (float)(Math.sinh((double)a));
         }
    @@ -3965,7 +3947,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::SINH, FloatMaxVectorTests::strictSINH);
         }
     
    -
         static float COSH(float a) {
             return (float)(Math.cosh((double)a));
         }
    @@ -3989,7 +3970,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::COSH, FloatMaxVectorTests::strictCOSH);
         }
     
    -
         static float TANH(float a) {
             return (float)(Math.tanh((double)a));
         }
    @@ -4013,7 +3993,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::TANH, FloatMaxVectorTests::strictTANH);
         }
     
    -
         static float ASIN(float a) {
             return (float)(Math.asin((double)a));
         }
    @@ -4037,7 +4016,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::ASIN, FloatMaxVectorTests::strictASIN);
         }
     
    -
         static float ACOS(float a) {
             return (float)(Math.acos((double)a));
         }
    @@ -4061,7 +4039,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::ACOS, FloatMaxVectorTests::strictACOS);
         }
     
    -
         static float ATAN(float a) {
             return (float)(Math.atan((double)a));
         }
    @@ -4085,7 +4062,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::ATAN, FloatMaxVectorTests::strictATAN);
         }
     
    -
         static float CBRT(float a) {
             return (float)(Math.cbrt((double)a));
         }
    @@ -4109,7 +4085,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, FloatMaxVectorTests::CBRT, FloatMaxVectorTests::strictCBRT);
         }
     
    -
         static float HYPOT(float a, float b) {
             return (float)(Math.hypot((double)a, (double)b));
         }
    @@ -4136,7 +4111,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float POW(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4162,6 +4136,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::POW, FloatMaxVectorTests::strictPOW);
         }
     
    +
         static float pow(float a, float b) {
             return (float)(Math.pow((double)a, (double)b));
         }
    @@ -4188,7 +4163,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float ATAN2(float a, float b) {
             return (float)(Math.atan2((double)a, (double)b));
         }
    @@ -4215,7 +4189,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
         }
     
     
    -
         @Test(dataProvider = "floatBinaryOpProvider")
         static void POWFloatMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4230,6 +4203,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEqualsWithinOneUlp(r, a, b, FloatMaxVectorTests::POW, FloatMaxVectorTests::strictPOW);
         }
     
    +
         @Test(dataProvider = "floatBinaryOpProvider")
         static void powFloatMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4245,15 +4219,14 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
         }
     
     
    -
         static float FMA(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
    +
         static float fma(float a, float b, float c) {
             return (float)(Math.fma(a, b, c));
         }
     
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloatMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4272,6 +4245,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloatMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4289,7 +4263,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, FloatMaxVectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloatMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4312,10 +4285,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloatMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4346,7 +4315,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloatMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4385,9 +4353,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
         }
     
    -
    -
    -
         @Test(dataProvider = "floatTernaryOpProvider")
         static void FMAFloatMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4402,6 +4367,7 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::FMA);
         }
    +
         @Test(dataProvider = "floatTernaryOpProvider")
         static void fmaFloatMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4417,7 +4383,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, FloatMaxVectorTests::fma);
         }
     
    -
         @Test(dataProvider = "floatTernaryOpMaskProvider")
         static void FMAFloatMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4436,9 +4401,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, FloatMaxVectorTests::FMA);
         }
     
    -
    -
    -
         static float NEG(float a) {
             return (float)(-((float)a));
         }
    @@ -4551,13 +4513,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, FloatMaxVectorTests::ABS);
         }
     
    -
    -
    -
    -
    -
    -
    -
         static float SQRT(float a) {
             return (float)(Math.sqrt((double)a));
         }
    @@ -4566,8 +4521,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             return (float)(Math.sqrt((double)a));
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpProvider")
         static void SQRTFloatMaxVectorTests(IntFunction fa) {
             float[] a = fa.apply(SPECIES.length());
    @@ -4598,8 +4551,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, FloatMaxVectorTests::sqrt);
         }
     
    -
    -
         @Test(dataProvider = "floatUnaryOpMaskProvider")
         static void SQRTMaskedFloatMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -4618,7 +4569,6 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, FloatMaxVectorTests::SQRT);
         }
     
    -
         @Test(dataProvider = "floatCompareOpProvider")
         static void ltFloatMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             float[] a = fa.apply(SPECIES.length());
    @@ -5020,6 +4970,23 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, FloatMaxVectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressFloatMaxVectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
     
         @DataProvider
         public static Object[][] offsetProvider() {
    @@ -5046,6 +5013,20 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongFloatMaxVectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5066,6 +5047,14 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongFloatMaxVectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeFloatMaxVectorTestsSmokeTest() {
             FloatVector av = FloatVector.zero(SPECIES);
    @@ -5128,4 +5117,3 @@ public class FloatMaxVectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java
    index 383b60a8de7..7ddc9f6ee55 100644
    --- a/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.IntVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.IntBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfInt ELEMENT_LAYOUT = ValueLayout.JAVA_INT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
     
    @@ -68,17 +70,6 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> INT_GENERATORS = List.of(
                 withToString("int[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferProvider() {
    +    public Object[][] intMemorySegmentProvider() {
             return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferMaskProvider() {
    +    public Object[][] intMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> INT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] intByteArrayProvider() {
    -        return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] intByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> INT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] intByteProviderForIOOBE() {
             var f = INT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(int[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (int v : a) {
    -            bb.putInt(v);
    +    static MemorySegment toSegment(int[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static int[] bufferToArray(ByteBuffer bb) {
    -        IntBuffer db = bb.asIntBuffer();
    -        int[] d = new int[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(int[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        IntBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asIntBuffer();
    -        for (int v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static int[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "intProvider")
         static void loadStoreArray(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "intByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "intMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             int[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "intByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "intByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Int128VectorTests.java b/test/jdk/jdk/incubator/vector/Int128VectorTests.java
    index 0f016e03ed3..4296c1a02a9 100644
    --- a/test/jdk/jdk/incubator/vector/Int128VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Int128VectorTests.java
    @@ -261,6 +261,55 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (int)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (int)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -884,7 +933,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(int e) {
             return  e;
         }
    @@ -979,8 +1027,6 @@ public class Int128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1026,7 +1072,6 @@ public class Int128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> INT_COMPARE_GENERATORS = List.of(
                 withToString("int[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1167,6 +1212,18 @@ public class Int128VectorTests extends AbstractVectorTest {
             return Integer.rotateRight(a, ((int)b));
         }
     
    +    static int TRAILING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfTrailingZeros(a);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfLeadingZeros(a);
    +    }
    +
    +    static int REVERSE_scalar(int a) {
    +        return Integer.reverse(a);
    +    }
    +
         static boolean eq(int a, int b) {
             return a == b;
         }
    @@ -1321,6 +1378,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static int ADD(int a, int b) {
             return (int)(a + b);
         }
    @@ -1341,6 +1399,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int128VectorTests::ADD);
         }
    +
         static int add(int a, int b) {
             return (int)(a + b);
         }
    @@ -1397,6 +1456,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Int128VectorTests::add);
         }
    +
         static int SUB(int a, int b) {
             return (int)(a - b);
         }
    @@ -1417,6 +1477,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int128VectorTests::SUB);
         }
    +
         static int sub(int a, int b) {
             return (int)(a - b);
         }
    @@ -1473,6 +1534,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Int128VectorTests::sub);
         }
    +
         static int MUL(int a, int b) {
             return (int)(a * b);
         }
    @@ -1493,6 +1555,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int128VectorTests::MUL);
         }
    +
         static int mul(int a, int b) {
             return (int)(a * b);
         }
    @@ -1550,8 +1613,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::mul);
         }
     
    -
    -
         static int DIV(int a, int b) {
             return (int)(a / b);
         }
    @@ -1574,6 +1635,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int128VectorTests::DIV);
         }
    +
         static int div(int a, int b) {
             return (int)(a / b);
         }
    @@ -1597,8 +1659,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void DIVInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1704,6 +1764,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int128VectorTests::AND);
         }
    +
         static int and(int a, int b) {
             return (int)(a & b);
         }
    @@ -1723,8 +1784,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1745,7 +1804,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::AND);
         }
     
    -
         static int AND_NOT(int a, int b) {
             return (int)(a & ~b);
         }
    @@ -1767,8 +1825,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void AND_NOTInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1789,7 +1845,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::AND_NOT);
         }
     
    -
         static int OR(int a, int b) {
             return (int)(a | b);
         }
    @@ -1810,6 +1865,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int128VectorTests::OR);
         }
    +
         static int or(int a, int b) {
             return (int)(a | b);
         }
    @@ -1829,8 +1885,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1851,7 +1905,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::OR);
         }
     
    -
         static int XOR(int a, int b) {
             return (int)(a ^ b);
         }
    @@ -1873,8 +1926,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void XORInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1895,6 +1946,87 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::XOR);
         }
     
    +    static int COMPRESS_BITS(int a, int b) {
    +        return (int)(Integer.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void COMPRESS_BITSInt128VectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Int128VectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void COMPRESS_BITSInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Int128VectorTests::COMPRESS_BITS);
    +    }
    +
    +    static int EXPAND_BITS(int a, int b) {
    +        return (int)(Integer.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void EXPAND_BITSInt128VectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Int128VectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void EXPAND_BITSInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Int128VectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "intBinaryOpProvider")
         static void addInt128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -1989,9 +2121,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int128VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void divInt128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2008,8 +2137,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void divInt128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2029,8 +2156,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORInt128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2059,8 +2184,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int128VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2078,8 +2201,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int128VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ANDInt128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2108,8 +2229,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int128VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDInt128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2127,8 +2246,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int128VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORInt128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2143,8 +2260,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Int128VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt128VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2162,7 +2277,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Int128VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ADDInt128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2215,8 +2329,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2237,11 +2349,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static int ASHR(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2263,8 +2370,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2285,11 +2390,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHR(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2311,8 +2411,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2333,11 +2431,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHL_unary(int a, int b) {
             return (int)((a << b));
         }
    @@ -2358,8 +2451,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int128VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLInt128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2379,11 +2470,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int128VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static int LSHR_unary(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2404,8 +2490,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int128VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRInt128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2425,11 +2509,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int128VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ASHR_unary(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2450,8 +2529,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int128VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRInt128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2471,11 +2548,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int128VectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ROR(int a, int b) {
             return (int)(ROR_scalar(a,b));
         }
    @@ -2497,8 +2569,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2519,7 +2589,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::ROR);
         }
     
    -
         static int ROL(int a, int b) {
             return (int)(ROL_scalar(a,b));
         }
    @@ -2541,8 +2610,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int128VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2563,7 +2630,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int128VectorTests::ROL);
         }
     
    -
         static int ROR_unary(int a, int b) {
             return (int)(ROR_scalar(a, b));
         }
    @@ -2584,8 +2650,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int128VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORInt128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2605,7 +2669,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int128VectorTests::ROR_unary);
         }
     
    -
         static int ROL_unary(int a, int b) {
             return (int)(ROL_scalar(a, b));
         }
    @@ -2626,8 +2689,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int128VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLInt128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2646,8 +2707,6 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Int128VectorTests::ROL_unary);
         }
    -
    -
         static int LSHR_binary_const(int a) {
             return (int)((a >>> CONST_SHIFT));
         }
    @@ -2667,8 +2726,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int128VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHRInt128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2687,12 +2744,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int128VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static int LSHL_binary_const(int a) {
             return (int)((a << CONST_SHIFT));
         }
    @@ -2712,8 +2763,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int128VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHLInt128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2732,8 +2781,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int128VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static int ASHR_binary_const(int a) {
             return (int)((a >> CONST_SHIFT));
         }
    @@ -2753,8 +2800,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int128VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ASHRInt128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2773,8 +2818,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int128VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static int ROR_binary_const(int a) {
             return (int)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2794,8 +2837,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int128VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void RORInt128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2814,8 +2855,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int128VectorTests::ROR_binary_const);
         }
     
    -
    -
         static int ROL_binary_const(int a) {
             return (int)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2835,8 +2874,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int128VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ROLInt128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2876,6 +2913,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int128VectorTests::MIN);
         }
    +
         static int min(int a, int b) {
             return (int)(Math.min(a, b));
         }
    @@ -2894,6 +2932,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int128VectorTests::min);
         }
    +
         static int MAX(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -2914,6 +2953,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int128VectorTests::MAX);
         }
    +
         static int max(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -3007,7 +3047,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ANDReduceInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3033,7 +3072,6 @@ public class Int128VectorTests extends AbstractVectorTest {
                     Int128VectorTests::ANDReduce, Int128VectorTests::ANDReduceAll);
         }
     
    -
         static int ANDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3053,7 +3091,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ANDReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3081,7 +3118,6 @@ public class Int128VectorTests extends AbstractVectorTest {
                     Int128VectorTests::ANDReduceMasked, Int128VectorTests::ANDReduceAllMasked);
         }
     
    -
         static int ORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3100,7 +3136,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ORReduceInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3126,7 +3161,6 @@ public class Int128VectorTests extends AbstractVectorTest {
                     Int128VectorTests::ORReduce, Int128VectorTests::ORReduceAll);
         }
     
    -
         static int ORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3146,7 +3180,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ORReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3174,7 +3207,6 @@ public class Int128VectorTests extends AbstractVectorTest {
                     Int128VectorTests::ORReduceMasked, Int128VectorTests::ORReduceAllMasked);
         }
     
    -
         static int XORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3193,7 +3225,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void XORReduceInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3219,7 +3250,6 @@ public class Int128VectorTests extends AbstractVectorTest {
                     Int128VectorTests::XORReduce, Int128VectorTests::XORReduceAll);
         }
     
    -
         static int XORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3239,7 +3269,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void XORReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3284,6 +3313,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void ADDReduceInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3308,6 +3338,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int128VectorTests::ADDReduce, Int128VectorTests::ADDReduceAll);
         }
    +
         static int ADDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3326,6 +3357,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ADDReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3352,6 +3384,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int128VectorTests::ADDReduceMasked, Int128VectorTests::ADDReduceAllMasked);
         }
    +
         static int MULReduce(int[] a, int idx) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3369,6 +3402,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MULReduceInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3393,6 +3427,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int128VectorTests::MULReduce, Int128VectorTests::MULReduceAll);
         }
    +
         static int MULReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3411,6 +3446,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MULReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3437,6 +3473,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int128VectorTests::MULReduceMasked, Int128VectorTests::MULReduceAllMasked);
         }
    +
         static int MINReduce(int[] a, int idx) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3454,6 +3491,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MINReduceInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3478,6 +3516,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int128VectorTests::MINReduce, Int128VectorTests::MINReduceAll);
         }
    +
         static int MINReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3496,6 +3535,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MINReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3522,6 +3562,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int128VectorTests::MINReduceMasked, Int128VectorTests::MINReduceAllMasked);
         }
    +
         static int MAXReduce(int[] a, int idx) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3539,6 +3580,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MAXReduceInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3563,6 +3605,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int128VectorTests::MAXReduce, Int128VectorTests::MAXReduceAll);
         }
    +
         static int MAXReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3581,6 +3624,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MAXReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3607,6 +3651,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int128VectorTests::MAXReduceMasked, Int128VectorTests::MAXReduceAllMasked);
         }
    +
         static int FIRST_NONZEROReduce(int[] a, int idx) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3624,6 +3669,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void FIRST_NONZEROReduceInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3648,6 +3694,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int128VectorTests::FIRST_NONZEROReduce, Int128VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static int FIRST_NONZEROReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3666,6 +3713,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3702,7 +3750,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueInt128VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3718,7 +3765,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Int128VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3728,7 +3774,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueInt128VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3744,7 +3789,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Int128VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void withInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3762,6 +3806,7 @@ public class Int128VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(int a) {
             return bits(a)==0;
         }
    @@ -3802,6 +3847,7 @@ public class Int128VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(int a) {
             return bits(a)<0;
         }
    @@ -3843,9 +3889,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3865,7 +3908,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void ltInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3908,7 +3950,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GTInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3951,7 +3992,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void EQInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3971,7 +4011,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void eqInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4014,7 +4053,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void NEInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4057,7 +4095,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LEInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4100,7 +4137,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GEInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4143,8 +4179,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LTInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4164,8 +4198,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LTInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4189,9 +4221,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GTInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4211,8 +4240,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GTInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4236,9 +4263,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LEInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4258,8 +4282,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LEInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4283,9 +4305,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GEInt128VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4305,8 +4324,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GEInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4330,8 +4347,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTInt128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4348,7 +4363,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTInt128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4385,7 +4399,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTInt128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4422,7 +4435,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQInt128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4459,7 +4471,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQInt128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4538,6 +4549,43 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void compressInt128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void expandInt128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void getInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4708,10 +4756,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZeroInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4726,9 +4770,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static int[] sliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4754,6 +4795,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Int128VectorTests::sliceUnary);
         }
    +
         static int[] sliceBinary(int[] a, int[] b, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4783,6 +4825,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Int128VectorTests::sliceBinary);
         }
    +
         static int[] slice(int[] a, int[] b, int origin, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4816,6 +4859,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Int128VectorTests::slice);
         }
    +
         static int[] unsliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4843,6 +4887,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Int128VectorTests::unsliceUnary);
         }
    +
         static int[] unsliceBinary(int[] a, int[] b, int origin, int part, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4882,6 +4927,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Int128VectorTests::unsliceBinary);
         }
    +
         static int[] unslice(int[] a, int[] b, int origin, int part, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4939,36 +4985,14 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Int128VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static int BITWISE_BLEND(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
    +
         static int bitwiseBlend(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4987,6 +5011,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Int128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5004,7 +5029,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Int128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5027,9 +5051,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Int128VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5059,6 +5080,7 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Int128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5089,7 +5111,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Int128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5128,9 +5149,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Int128VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5145,6 +5163,7 @@ public class Int128VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Int128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5160,7 +5179,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Int128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt128VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5179,7 +5197,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Int128VectorTests::BITWISE_BLEND);
         }
     
    -
         static int NEG(int a) {
             return (int)(-((int)a));
         }
    @@ -5292,7 +5309,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int128VectorTests::ABS);
         }
     
    -
         static int NOT(int a) {
             return (int)(~((int)a));
         }
    @@ -5301,8 +5317,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             return (int)(~((int)a));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void NOTInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5333,8 +5347,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Int128VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void NOTMaskedInt128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5353,14 +5365,10 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int128VectorTests::NOT);
         }
     
    -
    -
         static int ZOMO(int a) {
             return (int)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZOMOInt128VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5376,8 +5384,6 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Int128VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ZOMOMaskedInt128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5396,9 +5402,190 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int128VectorTests::ZOMO);
         }
     
    +    static int BIT_COUNT(int a) {
    +        return (int)(Integer.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void BIT_COUNTInt128VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Int128VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedInt128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int128VectorTests::BIT_COUNT);
    +    }
    +
    +    static int TRAILING_ZEROS_COUNT(int a) {
    +        return (int)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTInt128VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int128VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedInt128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int128VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT(int a) {
    +        return (int)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTInt128VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int128VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedInt128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int128VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static int REVERSE(int a) {
    +        return (int)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSEInt128VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int128VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSEMaskedInt128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int128VectorTests::REVERSE);
    +    }
    +
    +    static int REVERSE_BYTES(int a) {
    +        return (int)(Integer.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSE_BYTESInt128VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int128VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedInt128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int128VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "intCompareOpProvider")
         static void ltInt128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5801,6 +5988,23 @@ public class Int128VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Int128VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressInt128VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5843,6 +6047,20 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongInt128VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5863,6 +6081,14 @@ public class Int128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongInt128VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeInt128VectorTestsSmokeTest() {
             IntVector av = IntVector.zero(SPECIES);
    @@ -5925,4 +6151,3 @@ public class Int128VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java
    index 8636160946e..97b2e1ecc14 100644
    --- a/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.IntVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.IntBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfInt ELEMENT_LAYOUT = ValueLayout.JAVA_INT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
     
    @@ -68,17 +70,6 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> INT_GENERATORS = List.of(
                 withToString("int[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferProvider() {
    +    public Object[][] intMemorySegmentProvider() {
             return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferMaskProvider() {
    +    public Object[][] intMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> INT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] intByteArrayProvider() {
    -        return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] intByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> INT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] intByteProviderForIOOBE() {
             var f = INT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(int[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (int v : a) {
    -            bb.putInt(v);
    +    static MemorySegment toSegment(int[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static int[] bufferToArray(ByteBuffer bb) {
    -        IntBuffer db = bb.asIntBuffer();
    -        int[] d = new int[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(int[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        IntBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asIntBuffer();
    -        for (int v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static int[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "intProvider")
         static void loadStoreArray(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "intByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "intMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             int[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "intByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "intByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Int256VectorTests.java b/test/jdk/jdk/incubator/vector/Int256VectorTests.java
    index 70f58df00a4..89215583399 100644
    --- a/test/jdk/jdk/incubator/vector/Int256VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Int256VectorTests.java
    @@ -261,6 +261,55 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (int)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (int)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -884,7 +933,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(int e) {
             return  e;
         }
    @@ -979,8 +1027,6 @@ public class Int256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1026,7 +1072,6 @@ public class Int256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> INT_COMPARE_GENERATORS = List.of(
                 withToString("int[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1167,6 +1212,18 @@ public class Int256VectorTests extends AbstractVectorTest {
             return Integer.rotateRight(a, ((int)b));
         }
     
    +    static int TRAILING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfTrailingZeros(a);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfLeadingZeros(a);
    +    }
    +
    +    static int REVERSE_scalar(int a) {
    +        return Integer.reverse(a);
    +    }
    +
         static boolean eq(int a, int b) {
             return a == b;
         }
    @@ -1321,6 +1378,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static int ADD(int a, int b) {
             return (int)(a + b);
         }
    @@ -1341,6 +1399,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int256VectorTests::ADD);
         }
    +
         static int add(int a, int b) {
             return (int)(a + b);
         }
    @@ -1397,6 +1456,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Int256VectorTests::add);
         }
    +
         static int SUB(int a, int b) {
             return (int)(a - b);
         }
    @@ -1417,6 +1477,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int256VectorTests::SUB);
         }
    +
         static int sub(int a, int b) {
             return (int)(a - b);
         }
    @@ -1473,6 +1534,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Int256VectorTests::sub);
         }
    +
         static int MUL(int a, int b) {
             return (int)(a * b);
         }
    @@ -1493,6 +1555,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int256VectorTests::MUL);
         }
    +
         static int mul(int a, int b) {
             return (int)(a * b);
         }
    @@ -1550,8 +1613,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::mul);
         }
     
    -
    -
         static int DIV(int a, int b) {
             return (int)(a / b);
         }
    @@ -1574,6 +1635,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int256VectorTests::DIV);
         }
    +
         static int div(int a, int b) {
             return (int)(a / b);
         }
    @@ -1597,8 +1659,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void DIVInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1704,6 +1764,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int256VectorTests::AND);
         }
    +
         static int and(int a, int b) {
             return (int)(a & b);
         }
    @@ -1723,8 +1784,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1745,7 +1804,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::AND);
         }
     
    -
         static int AND_NOT(int a, int b) {
             return (int)(a & ~b);
         }
    @@ -1767,8 +1825,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void AND_NOTInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1789,7 +1845,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::AND_NOT);
         }
     
    -
         static int OR(int a, int b) {
             return (int)(a | b);
         }
    @@ -1810,6 +1865,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int256VectorTests::OR);
         }
    +
         static int or(int a, int b) {
             return (int)(a | b);
         }
    @@ -1829,8 +1885,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1851,7 +1905,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::OR);
         }
     
    -
         static int XOR(int a, int b) {
             return (int)(a ^ b);
         }
    @@ -1873,8 +1926,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void XORInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1895,6 +1946,87 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::XOR);
         }
     
    +    static int COMPRESS_BITS(int a, int b) {
    +        return (int)(Integer.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void COMPRESS_BITSInt256VectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Int256VectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void COMPRESS_BITSInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Int256VectorTests::COMPRESS_BITS);
    +    }
    +
    +    static int EXPAND_BITS(int a, int b) {
    +        return (int)(Integer.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void EXPAND_BITSInt256VectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Int256VectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void EXPAND_BITSInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Int256VectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "intBinaryOpProvider")
         static void addInt256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -1989,9 +2121,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int256VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void divInt256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2008,8 +2137,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void divInt256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2029,8 +2156,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORInt256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2059,8 +2184,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int256VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2078,8 +2201,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int256VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ANDInt256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2108,8 +2229,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int256VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDInt256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2127,8 +2246,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int256VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORInt256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2143,8 +2260,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Int256VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt256VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2162,7 +2277,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Int256VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ADDInt256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2215,8 +2329,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2237,11 +2349,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static int ASHR(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2263,8 +2370,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2285,11 +2390,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHR(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2311,8 +2411,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2333,11 +2431,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHL_unary(int a, int b) {
             return (int)((a << b));
         }
    @@ -2358,8 +2451,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int256VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLInt256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2379,11 +2470,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int256VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static int LSHR_unary(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2404,8 +2490,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int256VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRInt256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2425,11 +2509,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int256VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ASHR_unary(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2450,8 +2529,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int256VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRInt256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2471,11 +2548,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int256VectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ROR(int a, int b) {
             return (int)(ROR_scalar(a,b));
         }
    @@ -2497,8 +2569,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2519,7 +2589,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::ROR);
         }
     
    -
         static int ROL(int a, int b) {
             return (int)(ROL_scalar(a,b));
         }
    @@ -2541,8 +2610,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int256VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2563,7 +2630,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int256VectorTests::ROL);
         }
     
    -
         static int ROR_unary(int a, int b) {
             return (int)(ROR_scalar(a, b));
         }
    @@ -2584,8 +2650,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int256VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORInt256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2605,7 +2669,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int256VectorTests::ROR_unary);
         }
     
    -
         static int ROL_unary(int a, int b) {
             return (int)(ROL_scalar(a, b));
         }
    @@ -2626,8 +2689,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int256VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLInt256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2646,8 +2707,6 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Int256VectorTests::ROL_unary);
         }
    -
    -
         static int LSHR_binary_const(int a) {
             return (int)((a >>> CONST_SHIFT));
         }
    @@ -2667,8 +2726,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int256VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHRInt256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2687,12 +2744,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int256VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static int LSHL_binary_const(int a) {
             return (int)((a << CONST_SHIFT));
         }
    @@ -2712,8 +2763,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int256VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHLInt256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2732,8 +2781,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int256VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static int ASHR_binary_const(int a) {
             return (int)((a >> CONST_SHIFT));
         }
    @@ -2753,8 +2800,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int256VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ASHRInt256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2773,8 +2818,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int256VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static int ROR_binary_const(int a) {
             return (int)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2794,8 +2837,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int256VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void RORInt256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2814,8 +2855,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int256VectorTests::ROR_binary_const);
         }
     
    -
    -
         static int ROL_binary_const(int a) {
             return (int)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2835,8 +2874,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int256VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ROLInt256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2876,6 +2913,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int256VectorTests::MIN);
         }
    +
         static int min(int a, int b) {
             return (int)(Math.min(a, b));
         }
    @@ -2894,6 +2932,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int256VectorTests::min);
         }
    +
         static int MAX(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -2914,6 +2953,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int256VectorTests::MAX);
         }
    +
         static int max(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -3007,7 +3047,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ANDReduceInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3033,7 +3072,6 @@ public class Int256VectorTests extends AbstractVectorTest {
                     Int256VectorTests::ANDReduce, Int256VectorTests::ANDReduceAll);
         }
     
    -
         static int ANDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3053,7 +3091,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ANDReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3081,7 +3118,6 @@ public class Int256VectorTests extends AbstractVectorTest {
                     Int256VectorTests::ANDReduceMasked, Int256VectorTests::ANDReduceAllMasked);
         }
     
    -
         static int ORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3100,7 +3136,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ORReduceInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3126,7 +3161,6 @@ public class Int256VectorTests extends AbstractVectorTest {
                     Int256VectorTests::ORReduce, Int256VectorTests::ORReduceAll);
         }
     
    -
         static int ORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3146,7 +3180,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ORReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3174,7 +3207,6 @@ public class Int256VectorTests extends AbstractVectorTest {
                     Int256VectorTests::ORReduceMasked, Int256VectorTests::ORReduceAllMasked);
         }
     
    -
         static int XORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3193,7 +3225,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void XORReduceInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3219,7 +3250,6 @@ public class Int256VectorTests extends AbstractVectorTest {
                     Int256VectorTests::XORReduce, Int256VectorTests::XORReduceAll);
         }
     
    -
         static int XORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3239,7 +3269,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void XORReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3284,6 +3313,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void ADDReduceInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3308,6 +3338,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int256VectorTests::ADDReduce, Int256VectorTests::ADDReduceAll);
         }
    +
         static int ADDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3326,6 +3357,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ADDReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3352,6 +3384,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int256VectorTests::ADDReduceMasked, Int256VectorTests::ADDReduceAllMasked);
         }
    +
         static int MULReduce(int[] a, int idx) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3369,6 +3402,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MULReduceInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3393,6 +3427,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int256VectorTests::MULReduce, Int256VectorTests::MULReduceAll);
         }
    +
         static int MULReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3411,6 +3446,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MULReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3437,6 +3473,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int256VectorTests::MULReduceMasked, Int256VectorTests::MULReduceAllMasked);
         }
    +
         static int MINReduce(int[] a, int idx) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3454,6 +3491,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MINReduceInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3478,6 +3516,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int256VectorTests::MINReduce, Int256VectorTests::MINReduceAll);
         }
    +
         static int MINReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3496,6 +3535,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MINReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3522,6 +3562,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int256VectorTests::MINReduceMasked, Int256VectorTests::MINReduceAllMasked);
         }
    +
         static int MAXReduce(int[] a, int idx) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3539,6 +3580,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MAXReduceInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3563,6 +3605,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int256VectorTests::MAXReduce, Int256VectorTests::MAXReduceAll);
         }
    +
         static int MAXReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3581,6 +3624,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MAXReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3607,6 +3651,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int256VectorTests::MAXReduceMasked, Int256VectorTests::MAXReduceAllMasked);
         }
    +
         static int FIRST_NONZEROReduce(int[] a, int idx) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3624,6 +3669,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void FIRST_NONZEROReduceInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3648,6 +3694,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int256VectorTests::FIRST_NONZEROReduce, Int256VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static int FIRST_NONZEROReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3666,6 +3713,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3702,7 +3750,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueInt256VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3718,7 +3765,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Int256VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3728,7 +3774,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueInt256VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3744,7 +3789,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Int256VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void withInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3762,6 +3806,7 @@ public class Int256VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(int a) {
             return bits(a)==0;
         }
    @@ -3802,6 +3847,7 @@ public class Int256VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(int a) {
             return bits(a)<0;
         }
    @@ -3843,9 +3889,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3865,7 +3908,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void ltInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3908,7 +3950,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GTInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3951,7 +3992,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void EQInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3971,7 +4011,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void eqInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4014,7 +4053,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void NEInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4057,7 +4095,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LEInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4100,7 +4137,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GEInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4143,8 +4179,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LTInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4164,8 +4198,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LTInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4189,9 +4221,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GTInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4211,8 +4240,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GTInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4236,9 +4263,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LEInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4258,8 +4282,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LEInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4283,9 +4305,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GEInt256VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4305,8 +4324,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GEInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4330,8 +4347,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTInt256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4348,7 +4363,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTInt256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4385,7 +4399,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTInt256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4422,7 +4435,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQInt256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4459,7 +4471,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQInt256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4538,6 +4549,43 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void compressInt256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void expandInt256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void getInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4708,10 +4756,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZeroInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4726,9 +4770,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static int[] sliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4754,6 +4795,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Int256VectorTests::sliceUnary);
         }
    +
         static int[] sliceBinary(int[] a, int[] b, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4783,6 +4825,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Int256VectorTests::sliceBinary);
         }
    +
         static int[] slice(int[] a, int[] b, int origin, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4816,6 +4859,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Int256VectorTests::slice);
         }
    +
         static int[] unsliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4843,6 +4887,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Int256VectorTests::unsliceUnary);
         }
    +
         static int[] unsliceBinary(int[] a, int[] b, int origin, int part, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4882,6 +4927,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Int256VectorTests::unsliceBinary);
         }
    +
         static int[] unslice(int[] a, int[] b, int origin, int part, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4939,36 +4985,14 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Int256VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static int BITWISE_BLEND(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
    +
         static int bitwiseBlend(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4987,6 +5011,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Int256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5004,7 +5029,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Int256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5027,9 +5051,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Int256VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5059,6 +5080,7 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Int256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5089,7 +5111,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Int256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5128,9 +5149,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Int256VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5145,6 +5163,7 @@ public class Int256VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Int256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5160,7 +5179,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Int256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt256VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5179,7 +5197,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Int256VectorTests::BITWISE_BLEND);
         }
     
    -
         static int NEG(int a) {
             return (int)(-((int)a));
         }
    @@ -5292,7 +5309,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int256VectorTests::ABS);
         }
     
    -
         static int NOT(int a) {
             return (int)(~((int)a));
         }
    @@ -5301,8 +5317,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             return (int)(~((int)a));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void NOTInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5333,8 +5347,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Int256VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void NOTMaskedInt256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5353,14 +5365,10 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int256VectorTests::NOT);
         }
     
    -
    -
         static int ZOMO(int a) {
             return (int)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZOMOInt256VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5376,8 +5384,6 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Int256VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ZOMOMaskedInt256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5396,9 +5402,190 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int256VectorTests::ZOMO);
         }
     
    +    static int BIT_COUNT(int a) {
    +        return (int)(Integer.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void BIT_COUNTInt256VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Int256VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedInt256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int256VectorTests::BIT_COUNT);
    +    }
    +
    +    static int TRAILING_ZEROS_COUNT(int a) {
    +        return (int)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTInt256VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int256VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedInt256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int256VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT(int a) {
    +        return (int)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTInt256VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int256VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedInt256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int256VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static int REVERSE(int a) {
    +        return (int)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSEInt256VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int256VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSEMaskedInt256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int256VectorTests::REVERSE);
    +    }
    +
    +    static int REVERSE_BYTES(int a) {
    +        return (int)(Integer.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSE_BYTESInt256VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int256VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedInt256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int256VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "intCompareOpProvider")
         static void ltInt256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5801,6 +5988,23 @@ public class Int256VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Int256VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressInt256VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5843,6 +6047,20 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongInt256VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5863,6 +6081,14 @@ public class Int256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongInt256VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeInt256VectorTestsSmokeTest() {
             IntVector av = IntVector.zero(SPECIES);
    @@ -5925,4 +6151,3 @@ public class Int256VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java
    index 2a0bf22c86b..d6e3f18a2c5 100644
    --- a/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.IntVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.IntBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfInt ELEMENT_LAYOUT = ValueLayout.JAVA_INT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
     
    @@ -68,17 +70,6 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> INT_GENERATORS = List.of(
                 withToString("int[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferProvider() {
    +    public Object[][] intMemorySegmentProvider() {
             return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferMaskProvider() {
    +    public Object[][] intMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> INT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] intByteArrayProvider() {
    -        return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] intByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> INT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] intByteProviderForIOOBE() {
             var f = INT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(int[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (int v : a) {
    -            bb.putInt(v);
    +    static MemorySegment toSegment(int[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static int[] bufferToArray(ByteBuffer bb) {
    -        IntBuffer db = bb.asIntBuffer();
    -        int[] d = new int[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(int[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        IntBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asIntBuffer();
    -        for (int v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static int[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "intProvider")
         static void loadStoreArray(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "intByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "intMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             int[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "intByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "intByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Int512VectorTests.java b/test/jdk/jdk/incubator/vector/Int512VectorTests.java
    index 576ec6ca7d8..9c8523f06d8 100644
    --- a/test/jdk/jdk/incubator/vector/Int512VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Int512VectorTests.java
    @@ -261,6 +261,55 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (int)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (int)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -884,7 +933,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(int e) {
             return  e;
         }
    @@ -979,8 +1027,6 @@ public class Int512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1026,7 +1072,6 @@ public class Int512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> INT_COMPARE_GENERATORS = List.of(
                 withToString("int[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1167,6 +1212,18 @@ public class Int512VectorTests extends AbstractVectorTest {
             return Integer.rotateRight(a, ((int)b));
         }
     
    +    static int TRAILING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfTrailingZeros(a);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfLeadingZeros(a);
    +    }
    +
    +    static int REVERSE_scalar(int a) {
    +        return Integer.reverse(a);
    +    }
    +
         static boolean eq(int a, int b) {
             return a == b;
         }
    @@ -1321,6 +1378,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static int ADD(int a, int b) {
             return (int)(a + b);
         }
    @@ -1341,6 +1399,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int512VectorTests::ADD);
         }
    +
         static int add(int a, int b) {
             return (int)(a + b);
         }
    @@ -1397,6 +1456,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Int512VectorTests::add);
         }
    +
         static int SUB(int a, int b) {
             return (int)(a - b);
         }
    @@ -1417,6 +1477,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int512VectorTests::SUB);
         }
    +
         static int sub(int a, int b) {
             return (int)(a - b);
         }
    @@ -1473,6 +1534,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Int512VectorTests::sub);
         }
    +
         static int MUL(int a, int b) {
             return (int)(a * b);
         }
    @@ -1493,6 +1555,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int512VectorTests::MUL);
         }
    +
         static int mul(int a, int b) {
             return (int)(a * b);
         }
    @@ -1550,8 +1613,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::mul);
         }
     
    -
    -
         static int DIV(int a, int b) {
             return (int)(a / b);
         }
    @@ -1574,6 +1635,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int512VectorTests::DIV);
         }
    +
         static int div(int a, int b) {
             return (int)(a / b);
         }
    @@ -1597,8 +1659,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void DIVInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1704,6 +1764,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int512VectorTests::AND);
         }
    +
         static int and(int a, int b) {
             return (int)(a & b);
         }
    @@ -1723,8 +1784,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1745,7 +1804,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::AND);
         }
     
    -
         static int AND_NOT(int a, int b) {
             return (int)(a & ~b);
         }
    @@ -1767,8 +1825,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void AND_NOTInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1789,7 +1845,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::AND_NOT);
         }
     
    -
         static int OR(int a, int b) {
             return (int)(a | b);
         }
    @@ -1810,6 +1865,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int512VectorTests::OR);
         }
    +
         static int or(int a, int b) {
             return (int)(a | b);
         }
    @@ -1829,8 +1885,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1851,7 +1905,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::OR);
         }
     
    -
         static int XOR(int a, int b) {
             return (int)(a ^ b);
         }
    @@ -1873,8 +1926,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void XORInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1895,6 +1946,87 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::XOR);
         }
     
    +    static int COMPRESS_BITS(int a, int b) {
    +        return (int)(Integer.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void COMPRESS_BITSInt512VectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Int512VectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void COMPRESS_BITSInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Int512VectorTests::COMPRESS_BITS);
    +    }
    +
    +    static int EXPAND_BITS(int a, int b) {
    +        return (int)(Integer.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void EXPAND_BITSInt512VectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Int512VectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void EXPAND_BITSInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Int512VectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "intBinaryOpProvider")
         static void addInt512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -1989,9 +2121,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int512VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void divInt512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2008,8 +2137,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void divInt512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2029,8 +2156,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORInt512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2059,8 +2184,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int512VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2078,8 +2201,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int512VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ANDInt512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2108,8 +2229,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int512VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDInt512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2127,8 +2246,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int512VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORInt512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2143,8 +2260,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Int512VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt512VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2162,7 +2277,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Int512VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ADDInt512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2215,8 +2329,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2237,11 +2349,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static int ASHR(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2263,8 +2370,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2285,11 +2390,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHR(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2311,8 +2411,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2333,11 +2431,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHL_unary(int a, int b) {
             return (int)((a << b));
         }
    @@ -2358,8 +2451,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int512VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLInt512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2379,11 +2470,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int512VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static int LSHR_unary(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2404,8 +2490,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int512VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRInt512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2425,11 +2509,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int512VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ASHR_unary(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2450,8 +2529,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int512VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRInt512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2471,11 +2548,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int512VectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ROR(int a, int b) {
             return (int)(ROR_scalar(a,b));
         }
    @@ -2497,8 +2569,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2519,7 +2589,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::ROR);
         }
     
    -
         static int ROL(int a, int b) {
             return (int)(ROL_scalar(a,b));
         }
    @@ -2541,8 +2610,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int512VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2563,7 +2630,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int512VectorTests::ROL);
         }
     
    -
         static int ROR_unary(int a, int b) {
             return (int)(ROR_scalar(a, b));
         }
    @@ -2584,8 +2650,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int512VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORInt512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2605,7 +2669,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int512VectorTests::ROR_unary);
         }
     
    -
         static int ROL_unary(int a, int b) {
             return (int)(ROL_scalar(a, b));
         }
    @@ -2626,8 +2689,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int512VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLInt512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2646,8 +2707,6 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Int512VectorTests::ROL_unary);
         }
    -
    -
         static int LSHR_binary_const(int a) {
             return (int)((a >>> CONST_SHIFT));
         }
    @@ -2667,8 +2726,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int512VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHRInt512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2687,12 +2744,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int512VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static int LSHL_binary_const(int a) {
             return (int)((a << CONST_SHIFT));
         }
    @@ -2712,8 +2763,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int512VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHLInt512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2732,8 +2781,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int512VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static int ASHR_binary_const(int a) {
             return (int)((a >> CONST_SHIFT));
         }
    @@ -2753,8 +2800,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int512VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ASHRInt512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2773,8 +2818,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int512VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static int ROR_binary_const(int a) {
             return (int)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2794,8 +2837,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int512VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void RORInt512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2814,8 +2855,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int512VectorTests::ROR_binary_const);
         }
     
    -
    -
         static int ROL_binary_const(int a) {
             return (int)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2835,8 +2874,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int512VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ROLInt512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2876,6 +2913,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int512VectorTests::MIN);
         }
    +
         static int min(int a, int b) {
             return (int)(Math.min(a, b));
         }
    @@ -2894,6 +2932,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int512VectorTests::min);
         }
    +
         static int MAX(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -2914,6 +2953,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int512VectorTests::MAX);
         }
    +
         static int max(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -3007,7 +3047,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ANDReduceInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3033,7 +3072,6 @@ public class Int512VectorTests extends AbstractVectorTest {
                     Int512VectorTests::ANDReduce, Int512VectorTests::ANDReduceAll);
         }
     
    -
         static int ANDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3053,7 +3091,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ANDReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3081,7 +3118,6 @@ public class Int512VectorTests extends AbstractVectorTest {
                     Int512VectorTests::ANDReduceMasked, Int512VectorTests::ANDReduceAllMasked);
         }
     
    -
         static int ORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3100,7 +3136,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ORReduceInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3126,7 +3161,6 @@ public class Int512VectorTests extends AbstractVectorTest {
                     Int512VectorTests::ORReduce, Int512VectorTests::ORReduceAll);
         }
     
    -
         static int ORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3146,7 +3180,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ORReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3174,7 +3207,6 @@ public class Int512VectorTests extends AbstractVectorTest {
                     Int512VectorTests::ORReduceMasked, Int512VectorTests::ORReduceAllMasked);
         }
     
    -
         static int XORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3193,7 +3225,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void XORReduceInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3219,7 +3250,6 @@ public class Int512VectorTests extends AbstractVectorTest {
                     Int512VectorTests::XORReduce, Int512VectorTests::XORReduceAll);
         }
     
    -
         static int XORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3239,7 +3269,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void XORReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3284,6 +3313,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void ADDReduceInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3308,6 +3338,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int512VectorTests::ADDReduce, Int512VectorTests::ADDReduceAll);
         }
    +
         static int ADDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3326,6 +3357,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ADDReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3352,6 +3384,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int512VectorTests::ADDReduceMasked, Int512VectorTests::ADDReduceAllMasked);
         }
    +
         static int MULReduce(int[] a, int idx) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3369,6 +3402,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MULReduceInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3393,6 +3427,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int512VectorTests::MULReduce, Int512VectorTests::MULReduceAll);
         }
    +
         static int MULReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3411,6 +3446,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MULReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3437,6 +3473,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int512VectorTests::MULReduceMasked, Int512VectorTests::MULReduceAllMasked);
         }
    +
         static int MINReduce(int[] a, int idx) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3454,6 +3491,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MINReduceInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3478,6 +3516,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int512VectorTests::MINReduce, Int512VectorTests::MINReduceAll);
         }
    +
         static int MINReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3496,6 +3535,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MINReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3522,6 +3562,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int512VectorTests::MINReduceMasked, Int512VectorTests::MINReduceAllMasked);
         }
    +
         static int MAXReduce(int[] a, int idx) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3539,6 +3580,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MAXReduceInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3563,6 +3605,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int512VectorTests::MAXReduce, Int512VectorTests::MAXReduceAll);
         }
    +
         static int MAXReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3581,6 +3624,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MAXReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3607,6 +3651,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int512VectorTests::MAXReduceMasked, Int512VectorTests::MAXReduceAllMasked);
         }
    +
         static int FIRST_NONZEROReduce(int[] a, int idx) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3624,6 +3669,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void FIRST_NONZEROReduceInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3648,6 +3694,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int512VectorTests::FIRST_NONZEROReduce, Int512VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static int FIRST_NONZEROReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3666,6 +3713,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3702,7 +3750,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueInt512VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3718,7 +3765,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Int512VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3728,7 +3774,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueInt512VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3744,7 +3789,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Int512VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void withInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3762,6 +3806,7 @@ public class Int512VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(int a) {
             return bits(a)==0;
         }
    @@ -3802,6 +3847,7 @@ public class Int512VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(int a) {
             return bits(a)<0;
         }
    @@ -3843,9 +3889,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3865,7 +3908,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void ltInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3908,7 +3950,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GTInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3951,7 +3992,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void EQInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3971,7 +4011,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void eqInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4014,7 +4053,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void NEInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4057,7 +4095,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LEInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4100,7 +4137,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GEInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4143,8 +4179,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LTInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4164,8 +4198,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LTInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4189,9 +4221,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GTInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4211,8 +4240,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GTInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4236,9 +4263,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LEInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4258,8 +4282,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LEInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4283,9 +4305,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GEInt512VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4305,8 +4324,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GEInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4330,8 +4347,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTInt512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4348,7 +4363,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTInt512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4385,7 +4399,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTInt512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4422,7 +4435,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQInt512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4459,7 +4471,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQInt512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4538,6 +4549,43 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void compressInt512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void expandInt512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void getInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4708,10 +4756,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZeroInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4726,9 +4770,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static int[] sliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4754,6 +4795,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Int512VectorTests::sliceUnary);
         }
    +
         static int[] sliceBinary(int[] a, int[] b, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4783,6 +4825,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Int512VectorTests::sliceBinary);
         }
    +
         static int[] slice(int[] a, int[] b, int origin, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4816,6 +4859,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Int512VectorTests::slice);
         }
    +
         static int[] unsliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4843,6 +4887,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Int512VectorTests::unsliceUnary);
         }
    +
         static int[] unsliceBinary(int[] a, int[] b, int origin, int part, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4882,6 +4927,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Int512VectorTests::unsliceBinary);
         }
    +
         static int[] unslice(int[] a, int[] b, int origin, int part, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4939,36 +4985,14 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Int512VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static int BITWISE_BLEND(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
    +
         static int bitwiseBlend(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4987,6 +5011,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Int512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5004,7 +5029,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Int512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5027,9 +5051,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Int512VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5059,6 +5080,7 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Int512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5089,7 +5111,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Int512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5128,9 +5149,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Int512VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5145,6 +5163,7 @@ public class Int512VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Int512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5160,7 +5179,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Int512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt512VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5179,7 +5197,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Int512VectorTests::BITWISE_BLEND);
         }
     
    -
         static int NEG(int a) {
             return (int)(-((int)a));
         }
    @@ -5292,7 +5309,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int512VectorTests::ABS);
         }
     
    -
         static int NOT(int a) {
             return (int)(~((int)a));
         }
    @@ -5301,8 +5317,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             return (int)(~((int)a));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void NOTInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5333,8 +5347,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Int512VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void NOTMaskedInt512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5353,14 +5365,10 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int512VectorTests::NOT);
         }
     
    -
    -
         static int ZOMO(int a) {
             return (int)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZOMOInt512VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5376,8 +5384,6 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Int512VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ZOMOMaskedInt512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5396,9 +5402,190 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int512VectorTests::ZOMO);
         }
     
    +    static int BIT_COUNT(int a) {
    +        return (int)(Integer.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void BIT_COUNTInt512VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Int512VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedInt512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int512VectorTests::BIT_COUNT);
    +    }
    +
    +    static int TRAILING_ZEROS_COUNT(int a) {
    +        return (int)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTInt512VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int512VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedInt512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int512VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT(int a) {
    +        return (int)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTInt512VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int512VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedInt512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int512VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static int REVERSE(int a) {
    +        return (int)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSEInt512VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int512VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSEMaskedInt512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int512VectorTests::REVERSE);
    +    }
    +
    +    static int REVERSE_BYTES(int a) {
    +        return (int)(Integer.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSE_BYTESInt512VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int512VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedInt512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int512VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "intCompareOpProvider")
         static void ltInt512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5801,6 +5988,23 @@ public class Int512VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Int512VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressInt512VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5843,6 +6047,20 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongInt512VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5863,6 +6081,14 @@ public class Int512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongInt512VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeInt512VectorTestsSmokeTest() {
             IntVector av = IntVector.zero(SPECIES);
    @@ -5925,4 +6151,3 @@ public class Int512VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java
    index bc15c3c5450..b9157d93295 100644
    --- a/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.IntVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.IntBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfInt ELEMENT_LAYOUT = ValueLayout.JAVA_INT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
     
    @@ -68,17 +70,6 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> INT_GENERATORS = List.of(
                 withToString("int[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferProvider() {
    +    public Object[][] intMemorySegmentProvider() {
             return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferMaskProvider() {
    +    public Object[][] intMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> INT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] intByteArrayProvider() {
    -        return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] intByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> INT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] intByteProviderForIOOBE() {
             var f = INT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(int[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (int v : a) {
    -            bb.putInt(v);
    +    static MemorySegment toSegment(int[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static int[] bufferToArray(ByteBuffer bb) {
    -        IntBuffer db = bb.asIntBuffer();
    -        int[] d = new int[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(int[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        IntBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asIntBuffer();
    -        for (int v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static int[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "intProvider")
         static void loadStoreArray(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "intByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "intMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             int[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "intByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "intByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Int64VectorTests.java b/test/jdk/jdk/incubator/vector/Int64VectorTests.java
    index a6c398c2745..a02f5e3b4d8 100644
    --- a/test/jdk/jdk/incubator/vector/Int64VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Int64VectorTests.java
    @@ -261,6 +261,55 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (int)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (int)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -884,7 +933,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(int e) {
             return  e;
         }
    @@ -979,8 +1027,6 @@ public class Int64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1026,7 +1072,6 @@ public class Int64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> INT_COMPARE_GENERATORS = List.of(
                 withToString("int[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1167,6 +1212,18 @@ public class Int64VectorTests extends AbstractVectorTest {
             return Integer.rotateRight(a, ((int)b));
         }
     
    +    static int TRAILING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfTrailingZeros(a);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfLeadingZeros(a);
    +    }
    +
    +    static int REVERSE_scalar(int a) {
    +        return Integer.reverse(a);
    +    }
    +
         static boolean eq(int a, int b) {
             return a == b;
         }
    @@ -1321,6 +1378,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static int ADD(int a, int b) {
             return (int)(a + b);
         }
    @@ -1341,6 +1399,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int64VectorTests::ADD);
         }
    +
         static int add(int a, int b) {
             return (int)(a + b);
         }
    @@ -1397,6 +1456,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Int64VectorTests::add);
         }
    +
         static int SUB(int a, int b) {
             return (int)(a - b);
         }
    @@ -1417,6 +1477,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int64VectorTests::SUB);
         }
    +
         static int sub(int a, int b) {
             return (int)(a - b);
         }
    @@ -1473,6 +1534,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Int64VectorTests::sub);
         }
    +
         static int MUL(int a, int b) {
             return (int)(a * b);
         }
    @@ -1493,6 +1555,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int64VectorTests::MUL);
         }
    +
         static int mul(int a, int b) {
             return (int)(a * b);
         }
    @@ -1550,8 +1613,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::mul);
         }
     
    -
    -
         static int DIV(int a, int b) {
             return (int)(a / b);
         }
    @@ -1574,6 +1635,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int64VectorTests::DIV);
         }
    +
         static int div(int a, int b) {
             return (int)(a / b);
         }
    @@ -1597,8 +1659,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void DIVInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1704,6 +1764,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int64VectorTests::AND);
         }
    +
         static int and(int a, int b) {
             return (int)(a & b);
         }
    @@ -1723,8 +1784,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1745,7 +1804,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::AND);
         }
     
    -
         static int AND_NOT(int a, int b) {
             return (int)(a & ~b);
         }
    @@ -1767,8 +1825,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void AND_NOTInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1789,7 +1845,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::AND_NOT);
         }
     
    -
         static int OR(int a, int b) {
             return (int)(a | b);
         }
    @@ -1810,6 +1865,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int64VectorTests::OR);
         }
    +
         static int or(int a, int b) {
             return (int)(a | b);
         }
    @@ -1829,8 +1885,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1851,7 +1905,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::OR);
         }
     
    -
         static int XOR(int a, int b) {
             return (int)(a ^ b);
         }
    @@ -1873,8 +1926,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void XORInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1895,6 +1946,87 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::XOR);
         }
     
    +    static int COMPRESS_BITS(int a, int b) {
    +        return (int)(Integer.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void COMPRESS_BITSInt64VectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Int64VectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void COMPRESS_BITSInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Int64VectorTests::COMPRESS_BITS);
    +    }
    +
    +    static int EXPAND_BITS(int a, int b) {
    +        return (int)(Integer.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void EXPAND_BITSInt64VectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Int64VectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void EXPAND_BITSInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Int64VectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "intBinaryOpProvider")
         static void addInt64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -1989,9 +2121,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void divInt64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2008,8 +2137,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void divInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2029,8 +2156,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORInt64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2059,8 +2184,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int64VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2078,8 +2201,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ANDInt64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2108,8 +2229,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Int64VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2127,8 +2246,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Int64VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORInt64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2143,8 +2260,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Int64VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORInt64VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2162,7 +2277,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Int64VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ADDInt64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2215,8 +2329,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2237,11 +2349,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static int ASHR(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2263,8 +2370,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2285,11 +2390,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHR(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2311,8 +2411,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2333,11 +2431,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHL_unary(int a, int b) {
             return (int)((a << b));
         }
    @@ -2358,8 +2451,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int64VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLInt64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2379,11 +2470,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static int LSHR_unary(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2404,8 +2490,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int64VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRInt64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2425,11 +2509,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ASHR_unary(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2450,8 +2529,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int64VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRInt64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2471,11 +2548,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ROR(int a, int b) {
             return (int)(ROR_scalar(a,b));
         }
    @@ -2497,8 +2569,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2519,7 +2589,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::ROR);
         }
     
    -
         static int ROL(int a, int b) {
             return (int)(ROL_scalar(a,b));
         }
    @@ -2541,8 +2610,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Int64VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2563,7 +2630,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Int64VectorTests::ROL);
         }
     
    -
         static int ROR_unary(int a, int b) {
             return (int)(ROR_scalar(a, b));
         }
    @@ -2584,8 +2650,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int64VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORInt64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2605,7 +2669,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ROR_unary);
         }
     
    -
         static int ROL_unary(int a, int b) {
             return (int)(ROL_scalar(a, b));
         }
    @@ -2626,8 +2689,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Int64VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLInt64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2646,8 +2707,6 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Int64VectorTests::ROL_unary);
         }
    -
    -
         static int LSHR_binary_const(int a) {
             return (int)((a >>> CONST_SHIFT));
         }
    @@ -2667,8 +2726,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int64VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHRInt64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2687,12 +2744,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int64VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static int LSHL_binary_const(int a) {
             return (int)((a << CONST_SHIFT));
         }
    @@ -2712,8 +2763,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int64VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHLInt64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2732,8 +2781,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int64VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static int ASHR_binary_const(int a) {
             return (int)((a >> CONST_SHIFT));
         }
    @@ -2753,8 +2800,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int64VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ASHRInt64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2773,8 +2818,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int64VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static int ROR_binary_const(int a) {
             return (int)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2794,8 +2837,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int64VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void RORInt64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2814,8 +2855,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Int64VectorTests::ROR_binary_const);
         }
     
    -
    -
         static int ROL_binary_const(int a) {
             return (int)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2835,8 +2874,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Int64VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ROLInt64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2876,6 +2913,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int64VectorTests::MIN);
         }
    +
         static int min(int a, int b) {
             return (int)(Math.min(a, b));
         }
    @@ -2894,6 +2932,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int64VectorTests::min);
         }
    +
         static int MAX(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -2914,6 +2953,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Int64VectorTests::MAX);
         }
    +
         static int max(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -3007,7 +3047,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ANDReduceInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3033,7 +3072,6 @@ public class Int64VectorTests extends AbstractVectorTest {
                     Int64VectorTests::ANDReduce, Int64VectorTests::ANDReduceAll);
         }
     
    -
         static int ANDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3053,7 +3091,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ANDReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3081,7 +3118,6 @@ public class Int64VectorTests extends AbstractVectorTest {
                     Int64VectorTests::ANDReduceMasked, Int64VectorTests::ANDReduceAllMasked);
         }
     
    -
         static int ORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3100,7 +3136,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ORReduceInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3126,7 +3161,6 @@ public class Int64VectorTests extends AbstractVectorTest {
                     Int64VectorTests::ORReduce, Int64VectorTests::ORReduceAll);
         }
     
    -
         static int ORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3146,7 +3180,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ORReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3174,7 +3207,6 @@ public class Int64VectorTests extends AbstractVectorTest {
                     Int64VectorTests::ORReduceMasked, Int64VectorTests::ORReduceAllMasked);
         }
     
    -
         static int XORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3193,7 +3225,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void XORReduceInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3219,7 +3250,6 @@ public class Int64VectorTests extends AbstractVectorTest {
                     Int64VectorTests::XORReduce, Int64VectorTests::XORReduceAll);
         }
     
    -
         static int XORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3239,7 +3269,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void XORReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3284,6 +3313,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void ADDReduceInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3308,6 +3338,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int64VectorTests::ADDReduce, Int64VectorTests::ADDReduceAll);
         }
    +
         static int ADDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3326,6 +3357,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ADDReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3352,6 +3384,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int64VectorTests::ADDReduceMasked, Int64VectorTests::ADDReduceAllMasked);
         }
    +
         static int MULReduce(int[] a, int idx) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3369,6 +3402,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MULReduceInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3393,6 +3427,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int64VectorTests::MULReduce, Int64VectorTests::MULReduceAll);
         }
    +
         static int MULReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3411,6 +3446,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MULReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3437,6 +3473,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int64VectorTests::MULReduceMasked, Int64VectorTests::MULReduceAllMasked);
         }
    +
         static int MINReduce(int[] a, int idx) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3454,6 +3491,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MINReduceInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3478,6 +3516,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int64VectorTests::MINReduce, Int64VectorTests::MINReduceAll);
         }
    +
         static int MINReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3496,6 +3535,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MINReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3522,6 +3562,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int64VectorTests::MINReduceMasked, Int64VectorTests::MINReduceAllMasked);
         }
    +
         static int MAXReduce(int[] a, int idx) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3539,6 +3580,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MAXReduceInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3563,6 +3605,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int64VectorTests::MAXReduce, Int64VectorTests::MAXReduceAll);
         }
    +
         static int MAXReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3581,6 +3624,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MAXReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3607,6 +3651,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Int64VectorTests::MAXReduceMasked, Int64VectorTests::MAXReduceAllMasked);
         }
    +
         static int FIRST_NONZEROReduce(int[] a, int idx) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3624,6 +3669,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void FIRST_NONZEROReduceInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3648,6 +3694,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Int64VectorTests::FIRST_NONZEROReduce, Int64VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static int FIRST_NONZEROReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3666,6 +3713,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3702,7 +3750,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueInt64VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3718,7 +3765,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Int64VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3728,7 +3774,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueInt64VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3744,7 +3789,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Int64VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void withInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3762,6 +3806,7 @@ public class Int64VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(int a) {
             return bits(a)==0;
         }
    @@ -3802,6 +3847,7 @@ public class Int64VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(int a) {
             return bits(a)<0;
         }
    @@ -3843,9 +3889,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3865,7 +3908,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void ltInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3908,7 +3950,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GTInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3951,7 +3992,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void EQInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3971,7 +4011,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void eqInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4014,7 +4053,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void NEInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4057,7 +4095,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LEInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4100,7 +4137,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GEInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4143,8 +4179,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LTInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4164,8 +4198,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LTInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4189,9 +4221,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GTInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4211,8 +4240,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GTInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4236,9 +4263,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LEInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4258,8 +4282,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LEInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4283,9 +4305,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GEInt64VectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4305,8 +4324,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GEInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4330,8 +4347,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTInt64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4348,7 +4363,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4385,7 +4399,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTInt64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4422,7 +4435,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4459,7 +4471,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQInt64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4538,6 +4549,43 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void compressInt64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void expandInt64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void getInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4708,10 +4756,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZeroInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4726,9 +4770,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static int[] sliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4754,6 +4795,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Int64VectorTests::sliceUnary);
         }
    +
         static int[] sliceBinary(int[] a, int[] b, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4783,6 +4825,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Int64VectorTests::sliceBinary);
         }
    +
         static int[] slice(int[] a, int[] b, int origin, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4816,6 +4859,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Int64VectorTests::slice);
         }
    +
         static int[] unsliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4843,6 +4887,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Int64VectorTests::unsliceUnary);
         }
    +
         static int[] unsliceBinary(int[] a, int[] b, int origin, int part, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4882,6 +4927,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Int64VectorTests::unsliceBinary);
         }
    +
         static int[] unslice(int[] a, int[] b, int origin, int part, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4939,36 +4985,14 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Int64VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static int BITWISE_BLEND(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
    +
         static int bitwiseBlend(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4987,6 +5011,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5004,7 +5029,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5027,9 +5051,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5059,6 +5080,7 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5089,7 +5111,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5128,9 +5149,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDInt64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5145,6 +5163,7 @@ public class Int64VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Int64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendInt64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5160,7 +5179,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Int64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDInt64VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5179,7 +5197,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Int64VectorTests::BITWISE_BLEND);
         }
     
    -
         static int NEG(int a) {
             return (int)(-((int)a));
         }
    @@ -5292,7 +5309,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int64VectorTests::ABS);
         }
     
    -
         static int NOT(int a) {
             return (int)(~((int)a));
         }
    @@ -5301,8 +5317,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             return (int)(~((int)a));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void NOTInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5333,8 +5347,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Int64VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void NOTMaskedInt64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5353,14 +5365,10 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int64VectorTests::NOT);
         }
     
    -
    -
         static int ZOMO(int a) {
             return (int)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZOMOInt64VectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5376,8 +5384,6 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Int64VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ZOMOMaskedInt64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5396,9 +5402,190 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Int64VectorTests::ZOMO);
         }
     
    +    static int BIT_COUNT(int a) {
    +        return (int)(Integer.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void BIT_COUNTInt64VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Int64VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedInt64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int64VectorTests::BIT_COUNT);
    +    }
    +
    +    static int TRAILING_ZEROS_COUNT(int a) {
    +        return (int)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTInt64VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int64VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedInt64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int64VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT(int a) {
    +        return (int)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTInt64VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int64VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedInt64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int64VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static int REVERSE(int a) {
    +        return (int)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSEInt64VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int64VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSEMaskedInt64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int64VectorTests::REVERSE);
    +    }
    +
    +    static int REVERSE_BYTES(int a) {
    +        return (int)(Integer.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSE_BYTESInt64VectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Int64VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedInt64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Int64VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "intCompareOpProvider")
         static void ltInt64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5801,6 +5988,23 @@ public class Int64VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Int64VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressInt64VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5843,6 +6047,20 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongInt64VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5863,6 +6081,14 @@ public class Int64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongInt64VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeInt64VectorTestsSmokeTest() {
             IntVector av = IntVector.zero(SPECIES);
    @@ -5925,4 +6151,3 @@ public class Int64VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java
    index 860e2ba6950..2891c0c142e 100644
    --- a/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java
    @@ -32,6 +32,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.IntVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorShape;
    @@ -42,12 +45,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.lang.invoke.MethodHandles;
    -import java.lang.invoke.VarHandle;
    -import java.nio.ByteBuffer;
    -import java.nio.IntBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -58,6 +56,8 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfInt ELEMENT_LAYOUT = ValueLayout.JAVA_INT.withBitAlignment(8);
    +
         static VectorShape getMaxBit() {
             return VectorShape.S_Max_BIT;
         }
    @@ -77,17 +77,6 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> INT_GENERATORS = List.of(
                 withToString("int[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -127,7 +116,7 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -198,9 +187,9 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferProvider() {
    +    public Object[][] intMemorySegmentProvider() {
             return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -208,35 +197,16 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] intByteBufferMaskProvider() {
    +    public Object[][] intMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> INT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] intByteArrayProvider() {
    -        return INT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] intByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> INT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] intByteProviderForIOOBE() {
             var f = INT_GENERATORS.get(0);
    @@ -256,28 +226,16 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(int[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (int v : a) {
    -            bb.putInt(v);
    +    static MemorySegment toSegment(int[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static int[] bufferToArray(ByteBuffer bb) {
    -        IntBuffer db = bb.asIntBuffer();
    -        int[] d = new int[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(int[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        IntBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asIntBuffer();
    -        for (int v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static int[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -317,46 +275,25 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static IntVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static IntVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return IntVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(IntVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(IntVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static IntVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return IntVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(IntVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "intProvider")
         static void loadStoreArray(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -527,48 +464,45 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -580,25 +514,25 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -609,70 +543,61 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "intByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "intMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             int[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                IntVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -684,27 +609,27 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Integer.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Integer.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                IntVector av = IntVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            IntVector av = IntVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            IntVector av = IntVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -715,214 +640,36 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "intMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "intByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "intByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "intByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "intByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                IntVector av = IntVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            IntVector av = IntVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -937,6 +684,7 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java
    index 80dc1906826..e9f4d30430b 100644
    --- a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java
    @@ -266,6 +266,55 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (int)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(int[] r, int[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (int)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (int)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(int[] r, int[] a, int[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -889,7 +938,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static int bits(int e) {
             return  e;
         }
    @@ -984,8 +1032,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1031,7 +1077,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> INT_COMPARE_GENERATORS = List.of(
                 withToString("int[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1172,6 +1217,18 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return Integer.rotateRight(a, ((int)b));
         }
     
    +    static int TRAILING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfTrailingZeros(a);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT_scalar(int a) {
    +        return Integer.numberOfLeadingZeros(a);
    +    }
    +
    +    static int REVERSE_scalar(int a) {
    +        return Integer.reverse(a);
    +    }
    +
         static boolean eq(int a, int b) {
             return a == b;
         }
    @@ -1326,6 +1383,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static int ADD(int a, int b) {
             return (int)(a + b);
         }
    @@ -1346,6 +1404,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, IntMaxVectorTests::ADD);
         }
    +
         static int add(int a, int b) {
             return (int)(a + b);
         }
    @@ -1402,6 +1461,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::add);
         }
    +
         static int SUB(int a, int b) {
             return (int)(a - b);
         }
    @@ -1422,6 +1482,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, IntMaxVectorTests::SUB);
         }
    +
         static int sub(int a, int b) {
             return (int)(a - b);
         }
    @@ -1478,6 +1539,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::sub);
         }
    +
         static int MUL(int a, int b) {
             return (int)(a * b);
         }
    @@ -1498,6 +1560,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, IntMaxVectorTests::MUL);
         }
    +
         static int mul(int a, int b) {
             return (int)(a * b);
         }
    @@ -1555,8 +1618,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::mul);
         }
     
    -
    -
         static int DIV(int a, int b) {
             return (int)(a / b);
         }
    @@ -1579,6 +1640,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, IntMaxVectorTests::DIV);
         }
    +
         static int div(int a, int b) {
             return (int)(a / b);
         }
    @@ -1602,8 +1664,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void DIVIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1709,6 +1769,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, IntMaxVectorTests::AND);
         }
    +
         static int and(int a, int b) {
             return (int)(a & b);
         }
    @@ -1728,8 +1789,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1750,7 +1809,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::AND);
         }
     
    -
         static int AND_NOT(int a, int b) {
             return (int)(a & ~b);
         }
    @@ -1772,8 +1830,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void AND_NOTIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1794,7 +1850,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::AND_NOT);
         }
     
    -
         static int OR(int a, int b) {
             return (int)(a | b);
         }
    @@ -1815,6 +1870,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, IntMaxVectorTests::OR);
         }
    +
         static int or(int a, int b) {
             return (int)(a | b);
         }
    @@ -1834,8 +1890,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1856,7 +1910,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::OR);
         }
     
    -
         static int XOR(int a, int b) {
             return (int)(a ^ b);
         }
    @@ -1878,8 +1931,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void XORIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1900,6 +1951,87 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::XOR);
         }
     
    +    static int COMPRESS_BITS(int a, int b) {
    +        return (int)(Integer.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void COMPRESS_BITSIntMaxVectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, IntMaxVectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void COMPRESS_BITSIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, IntMaxVectorTests::COMPRESS_BITS);
    +    }
    +
    +    static int EXPAND_BITS(int a, int b) {
    +        return (int)(Integer.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpProvider")
    +    static void EXPAND_BITSIntMaxVectorTests(IntFunction fa, IntFunction fb) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, IntMaxVectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "intBinaryOpMaskProvider")
    +    static void EXPAND_BITSIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] b = fb.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                IntVector bv = IntVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, IntMaxVectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "intBinaryOpProvider")
         static void addIntMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -1994,9 +2126,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, IntMaxVectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void divIntMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2013,8 +2142,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, IntMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void divIntMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2034,8 +2161,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, IntMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORIntMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2064,8 +2189,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, IntMaxVectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORIntMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2083,8 +2206,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, IntMaxVectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ANDIntMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2113,8 +2234,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, IntMaxVectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ANDIntMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2132,8 +2251,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, IntMaxVectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ORIntMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2148,8 +2265,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, IntMaxVectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ORIntMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2167,7 +2282,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, IntMaxVectorTests::OR);
         }
     
    -
         @Test(dataProvider = "intBinaryOpProvider")
         static void ADDIntMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -2220,8 +2334,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2242,11 +2354,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static int ASHR(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2268,8 +2375,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2290,11 +2395,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHR(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2316,8 +2416,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2338,11 +2436,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static int LSHL_unary(int a, int b) {
             return (int)((a << b));
         }
    @@ -2363,8 +2456,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, IntMaxVectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHLIntMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2384,11 +2475,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, IntMaxVectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static int LSHR_unary(int a, int b) {
             return (int)((a >>> b));
         }
    @@ -2409,8 +2495,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, IntMaxVectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void LSHRIntMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2430,11 +2514,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, IntMaxVectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ASHR_unary(int a, int b) {
             return (int)((a >> b));
         }
    @@ -2455,8 +2534,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, IntMaxVectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ASHRIntMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2476,11 +2553,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, IntMaxVectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static int ROR(int a, int b) {
             return (int)(ROR_scalar(a,b));
         }
    @@ -2502,8 +2574,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2524,7 +2594,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::ROR);
         }
     
    -
         static int ROL(int a, int b) {
             return (int)(ROL_scalar(a,b));
         }
    @@ -2546,8 +2615,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, IntMaxVectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2568,7 +2635,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, IntMaxVectorTests::ROL);
         }
     
    -
         static int ROR_unary(int a, int b) {
             return (int)(ROR_scalar(a, b));
         }
    @@ -2589,8 +2655,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, IntMaxVectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void RORIntMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2610,7 +2674,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, IntMaxVectorTests::ROR_unary);
         }
     
    -
         static int ROL_unary(int a, int b) {
             return (int)(ROL_scalar(a, b));
         }
    @@ -2631,8 +2694,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, IntMaxVectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "intBinaryOpMaskProvider")
         static void ROLIntMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2651,8 +2712,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, IntMaxVectorTests::ROL_unary);
         }
    -
    -
         static int LSHR_binary_const(int a) {
             return (int)((a >>> CONST_SHIFT));
         }
    @@ -2672,8 +2731,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, IntMaxVectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHRIntMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2692,12 +2749,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, IntMaxVectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static int LSHL_binary_const(int a) {
             return (int)((a << CONST_SHIFT));
         }
    @@ -2717,8 +2768,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, IntMaxVectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void LSHLIntMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2737,8 +2786,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, IntMaxVectorTests::LSHL_binary_const);
         }
     
    -
    -
         static int ASHR_binary_const(int a) {
             return (int)((a >> CONST_SHIFT));
         }
    @@ -2758,8 +2805,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, IntMaxVectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ASHRIntMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2778,8 +2823,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, IntMaxVectorTests::ASHR_binary_const);
         }
     
    -
    -
         static int ROR_binary_const(int a) {
             return (int)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2799,8 +2842,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, IntMaxVectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void RORIntMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2819,8 +2860,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, IntMaxVectorTests::ROR_binary_const);
         }
     
    -
    -
         static int ROL_binary_const(int a) {
             return (int)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2840,8 +2879,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, IntMaxVectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ROLIntMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2881,6 +2918,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, IntMaxVectorTests::MIN);
         }
    +
         static int min(int a, int b) {
             return (int)(Math.min(a, b));
         }
    @@ -2899,6 +2937,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, IntMaxVectorTests::min);
         }
    +
         static int MAX(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -2919,6 +2958,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, IntMaxVectorTests::MAX);
         }
    +
         static int max(int a, int b) {
             return (int)(Math.max(a, b));
         }
    @@ -3012,7 +3052,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ANDReduceIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3038,7 +3077,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
                     IntMaxVectorTests::ANDReduce, IntMaxVectorTests::ANDReduceAll);
         }
     
    -
         static int ANDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3058,7 +3096,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ANDReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3086,7 +3123,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
                     IntMaxVectorTests::ANDReduceMasked, IntMaxVectorTests::ANDReduceAllMasked);
         }
     
    -
         static int ORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3105,7 +3141,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ORReduceIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3131,7 +3166,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
                     IntMaxVectorTests::ORReduce, IntMaxVectorTests::ORReduceAll);
         }
     
    -
         static int ORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3151,7 +3185,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ORReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3179,7 +3212,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
                     IntMaxVectorTests::ORReduceMasked, IntMaxVectorTests::ORReduceAllMasked);
         }
     
    -
         static int XORReduce(int[] a, int idx) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3198,7 +3230,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void XORReduceIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3224,7 +3255,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
                     IntMaxVectorTests::XORReduce, IntMaxVectorTests::XORReduceAll);
         }
     
    -
         static int XORReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3244,7 +3274,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void XORReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3289,6 +3318,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void ADDReduceIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3313,6 +3343,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     IntMaxVectorTests::ADDReduce, IntMaxVectorTests::ADDReduceAll);
         }
    +
         static int ADDReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3331,6 +3362,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ADDReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3357,6 +3389,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     IntMaxVectorTests::ADDReduceMasked, IntMaxVectorTests::ADDReduceAllMasked);
         }
    +
         static int MULReduce(int[] a, int idx) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3374,6 +3407,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MULReduceIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3398,6 +3432,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     IntMaxVectorTests::MULReduce, IntMaxVectorTests::MULReduceAll);
         }
    +
         static int MULReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3416,6 +3451,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MULReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3442,6 +3478,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     IntMaxVectorTests::MULReduceMasked, IntMaxVectorTests::MULReduceAllMasked);
         }
    +
         static int MINReduce(int[] a, int idx) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3459,6 +3496,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MINReduceIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3483,6 +3521,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     IntMaxVectorTests::MINReduce, IntMaxVectorTests::MINReduceAll);
         }
    +
         static int MINReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3501,6 +3540,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MINReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3527,6 +3567,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     IntMaxVectorTests::MINReduceMasked, IntMaxVectorTests::MINReduceAllMasked);
         }
    +
         static int MAXReduce(int[] a, int idx) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3544,6 +3585,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void MAXReduceIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3568,6 +3610,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     IntMaxVectorTests::MAXReduce, IntMaxVectorTests::MAXReduceAll);
         }
    +
         static int MAXReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = Integer.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3586,6 +3629,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void MAXReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3612,6 +3656,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     IntMaxVectorTests::MAXReduceMasked, IntMaxVectorTests::MAXReduceAllMasked);
         }
    +
         static int FIRST_NONZEROReduce(int[] a, int idx) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3629,6 +3674,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void FIRST_NONZEROReduceIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3653,6 +3699,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     IntMaxVectorTests::FIRST_NONZEROReduce, IntMaxVectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static int FIRST_NONZEROReduceMasked(int[] a, int idx, boolean[] mask) {
             int res = (int) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3671,6 +3718,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3707,7 +3755,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueIntMaxVectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3723,7 +3770,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, IntMaxVectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3733,7 +3779,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueIntMaxVectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3749,7 +3794,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, IntMaxVectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void withIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3767,6 +3811,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (int)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(int a) {
             return bits(a)==0;
         }
    @@ -3807,6 +3852,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(int a) {
             return bits(a)<0;
         }
    @@ -3848,9 +3894,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3870,7 +3913,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void ltIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3913,7 +3955,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GTIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3956,7 +3997,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void EQIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -3976,7 +4016,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void eqIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4019,7 +4058,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void NEIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4062,7 +4100,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LEIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4105,7 +4142,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void GEIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4148,8 +4184,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LTIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4169,8 +4203,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LTIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4194,9 +4226,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GTIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4216,8 +4245,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GTIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4241,9 +4268,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_LEIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4263,8 +4287,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_LEIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4288,9 +4310,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void UNSIGNED_GEIntMaxVectorTests(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4310,8 +4329,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void UNSIGNED_GEIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4335,8 +4352,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "intCompareOpProvider")
         static void LTIntMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4353,7 +4368,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTIntMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4390,7 +4404,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void LTIntMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4427,7 +4440,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQIntMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4464,7 +4476,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "intCompareOpMaskProvider")
         static void EQIntMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4543,6 +4554,43 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void compressIntMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void expandIntMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "intUnaryOpProvider")
         static void getIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4713,10 +4761,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZeroIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4731,9 +4775,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static int[] sliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4759,6 +4800,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, IntMaxVectorTests::sliceUnary);
         }
    +
         static int[] sliceBinary(int[] a, int[] b, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4788,6 +4830,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, IntMaxVectorTests::sliceBinary);
         }
    +
         static int[] slice(int[] a, int[] b, int origin, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4821,6 +4864,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, IntMaxVectorTests::slice);
         }
    +
         static int[] unsliceUnary(int[] a, int origin, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4848,6 +4892,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, IntMaxVectorTests::unsliceUnary);
         }
    +
         static int[] unsliceBinary(int[] a, int[] b, int origin, int part, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4887,6 +4932,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, IntMaxVectorTests::unsliceBinary);
         }
    +
         static int[] unslice(int[] a, int[] b, int origin, int part, boolean[] mask, int idx) {
             int[] res = new int[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4944,36 +4990,14 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, IntMaxVectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static int BITWISE_BLEND(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
    +
         static int bitwiseBlend(int a, int b, int c) {
             return (int)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDIntMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -4992,6 +5016,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, IntMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendIntMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5009,7 +5034,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, IntMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDIntMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5032,9 +5056,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, IntMaxVectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDIntMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5064,6 +5085,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, IntMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendIntMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5094,7 +5116,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, IntMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDIntMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5133,9 +5154,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, IntMaxVectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "intTernaryOpProvider")
         static void BITWISE_BLENDIntMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5150,6 +5168,7 @@ public class IntMaxVectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, IntMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "intTernaryOpProvider")
         static void bitwiseBlendIntMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5165,7 +5184,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, IntMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "intTernaryOpMaskProvider")
         static void BITWISE_BLENDIntMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5184,7 +5202,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, IntMaxVectorTests::BITWISE_BLEND);
         }
     
    -
         static int NEG(int a) {
             return (int)(-((int)a));
         }
    @@ -5297,7 +5314,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, IntMaxVectorTests::ABS);
         }
     
    -
         static int NOT(int a) {
             return (int)(~((int)a));
         }
    @@ -5306,8 +5322,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             return (int)(~((int)a));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void NOTIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5338,8 +5352,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, IntMaxVectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void NOTMaskedIntMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5358,14 +5370,10 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, IntMaxVectorTests::NOT);
         }
     
    -
    -
         static int ZOMO(int a) {
             return (int)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpProvider")
         static void ZOMOIntMaxVectorTests(IntFunction fa) {
             int[] a = fa.apply(SPECIES.length());
    @@ -5381,8 +5389,6 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, IntMaxVectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "intUnaryOpMaskProvider")
         static void ZOMOMaskedIntMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5401,9 +5407,190 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, IntMaxVectorTests::ZOMO);
         }
     
    +    static int BIT_COUNT(int a) {
    +        return (int)(Integer.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void BIT_COUNTIntMaxVectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, IntMaxVectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedIntMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, IntMaxVectorTests::BIT_COUNT);
    +    }
    +
    +    static int TRAILING_ZEROS_COUNT(int a) {
    +        return (int)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTIntMaxVectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, IntMaxVectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedIntMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, IntMaxVectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static int LEADING_ZEROS_COUNT(int a) {
    +        return (int)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTIntMaxVectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, IntMaxVectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedIntMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, IntMaxVectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static int REVERSE(int a) {
    +        return (int)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSEIntMaxVectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, IntMaxVectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSEMaskedIntMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, IntMaxVectorTests::REVERSE);
    +    }
    +
    +    static int REVERSE_BYTES(int a) {
    +        return (int)(Integer.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpProvider")
    +    static void REVERSE_BYTESIntMaxVectorTests(IntFunction fa) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, IntMaxVectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "intUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedIntMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        int[] a = fa.apply(SPECIES.length());
    +        int[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                IntVector av = IntVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, IntMaxVectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "intCompareOpProvider")
         static void ltIntMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5806,6 +5993,23 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, IntMaxVectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressIntMaxVectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
     
         @DataProvider
         public static Object[][] offsetProvider() {
    @@ -5832,6 +6036,20 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongIntMaxVectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5852,6 +6070,14 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongIntMaxVectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeIntMaxVectorTestsSmokeTest() {
             IntVector av = IntVector.zero(SPECIES);
    @@ -5914,4 +6140,3 @@ public class IntMaxVectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java
    index c57f936ff63..cebd1c4cb32 100644
    --- a/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.LongVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.LongBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfLong ELEMENT_LAYOUT = ValueLayout.JAVA_LONG.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
     
    @@ -68,17 +70,6 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> LONG_GENERATORS = List.of(
                 withToString("long[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferProvider() {
    +    public Object[][] longMemorySegmentProvider() {
             return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferMaskProvider() {
    +    public Object[][] longMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> LONG_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] longByteArrayProvider() {
    -        return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] longByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> LONG_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] longByteProviderForIOOBE() {
             var f = LONG_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(long[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (long v : a) {
    -            bb.putLong(v);
    +    static MemorySegment toSegment(long[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static long[] bufferToArray(ByteBuffer bb) {
    -        LongBuffer db = bb.asLongBuffer();
    -        long[] d = new long[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(long[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        LongBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asLongBuffer();
    -        for (long v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static long[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "longProvider")
         static void loadStoreArray(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "longByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "longMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             long[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "longByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "longByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Long128VectorTests.java b/test/jdk/jdk/incubator/vector/Long128VectorTests.java
    index ab73f2b47d7..09cd9e417fb 100644
    --- a/test/jdk/jdk/incubator/vector/Long128VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Long128VectorTests.java
    @@ -218,6 +218,55 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (long)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (long)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(long[] r, long[] a, long[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -874,7 +923,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static long bits(long e) {
             return  e;
         }
    @@ -976,7 +1024,6 @@ public class Long128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1052,7 +1099,6 @@ public class Long128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> LONG_COMPARE_GENERATORS = List.of(
                 withToString("long[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1164,7 +1210,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return new boolean[length];
         };
     
    -
         static void replaceZero(long[] a, long v) {
             for (int i = 0; i < a.length; i++) {
                 if (a[i] == 0) {
    @@ -1189,6 +1234,18 @@ public class Long128VectorTests extends AbstractVectorTest {
             return Long.rotateRight(a, ((int)b));
         }
     
    +    static long TRAILING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfTrailingZeros(a);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfLeadingZeros(a);
    +    }
    +
    +    static long REVERSE_scalar(long a) {
    +        return Long.reverse(a);
    +    }
    +
         static boolean eq(long a, long b) {
             return a == b;
         }
    @@ -1343,6 +1400,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static long ADD(long a, long b) {
             return (long)(a + b);
         }
    @@ -1363,6 +1421,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long128VectorTests::ADD);
         }
    +
         static long add(long a, long b) {
             return (long)(a + b);
         }
    @@ -1419,6 +1478,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Long128VectorTests::add);
         }
    +
         static long SUB(long a, long b) {
             return (long)(a - b);
         }
    @@ -1439,6 +1499,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long128VectorTests::SUB);
         }
    +
         static long sub(long a, long b) {
             return (long)(a - b);
         }
    @@ -1495,6 +1556,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Long128VectorTests::sub);
         }
    +
         static long MUL(long a, long b) {
             return (long)(a * b);
         }
    @@ -1515,6 +1577,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long128VectorTests::MUL);
         }
    +
         static long mul(long a, long b) {
             return (long)(a * b);
         }
    @@ -1572,8 +1635,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::mul);
         }
     
    -
    -
         static long DIV(long a, long b) {
             return (long)(a / b);
         }
    @@ -1596,6 +1657,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long128VectorTests::DIV);
         }
    +
         static long div(long a, long b) {
             return (long)(a / b);
         }
    @@ -1619,8 +1681,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void DIVLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1726,6 +1786,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long128VectorTests::AND);
         }
    +
         static long and(long a, long b) {
             return (long)(a & b);
         }
    @@ -1745,8 +1806,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1767,7 +1826,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::AND);
         }
     
    -
         static long AND_NOT(long a, long b) {
             return (long)(a & ~b);
         }
    @@ -1789,8 +1847,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void AND_NOTLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1811,7 +1867,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::AND_NOT);
         }
     
    -
         static long OR(long a, long b) {
             return (long)(a | b);
         }
    @@ -1832,6 +1887,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long128VectorTests::OR);
         }
    +
         static long or(long a, long b) {
             return (long)(a | b);
         }
    @@ -1851,8 +1907,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1873,7 +1927,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::OR);
         }
     
    -
         static long XOR(long a, long b) {
             return (long)(a ^ b);
         }
    @@ -1895,8 +1948,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void XORLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1917,6 +1968,87 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::XOR);
         }
     
    +    static long COMPRESS_BITS(long a, long b) {
    +        return (long)(Long.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void COMPRESS_BITSLong128VectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Long128VectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void COMPRESS_BITSLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Long128VectorTests::COMPRESS_BITS);
    +    }
    +
    +    static long EXPAND_BITS(long a, long b) {
    +        return (long)(Long.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void EXPAND_BITSLong128VectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Long128VectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void EXPAND_BITSLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Long128VectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "longBinaryOpProvider")
         static void addLong128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -2011,9 +2143,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long128VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void divLong128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2030,8 +2159,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void divLong128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2051,8 +2178,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLong128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2081,8 +2206,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long128VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2100,8 +2223,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long128VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ANDLong128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2130,8 +2251,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long128VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLong128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2149,8 +2268,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long128VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLong128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2165,8 +2282,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Long128VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong128VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2184,7 +2299,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Long128VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ADDLong128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2237,8 +2351,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2259,11 +2371,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static long ASHR(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2285,8 +2392,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2307,11 +2412,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHR(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2333,8 +2433,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2355,11 +2453,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHL_unary(long a, long b) {
             return (long)((a << b));
         }
    @@ -2380,8 +2473,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long128VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLong128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2401,11 +2492,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long128VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static long LSHR_unary(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2426,8 +2512,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long128VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLong128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2447,11 +2531,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long128VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ASHR_unary(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2472,8 +2551,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long128VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLong128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2493,11 +2570,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long128VectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ROR(long a, long b) {
             return (long)(ROR_scalar(a,b));
         }
    @@ -2519,8 +2591,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2541,7 +2611,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::ROR);
         }
     
    -
         static long ROL(long a, long b) {
             return (long)(ROL_scalar(a,b));
         }
    @@ -2563,8 +2632,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long128VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2585,7 +2652,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long128VectorTests::ROL);
         }
     
    -
         static long ROR_unary(long a, long b) {
             return (long)(ROR_scalar(a, b));
         }
    @@ -2606,8 +2672,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long128VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLong128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2627,7 +2691,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long128VectorTests::ROR_unary);
         }
     
    -
         static long ROL_unary(long a, long b) {
             return (long)(ROL_scalar(a, b));
         }
    @@ -2648,8 +2711,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long128VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLong128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2668,8 +2729,6 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Long128VectorTests::ROL_unary);
         }
    -
    -
         static long LSHR_binary_const(long a) {
             return (long)((a >>> CONST_SHIFT));
         }
    @@ -2689,8 +2748,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long128VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHRLong128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2709,12 +2766,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long128VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static long LSHL_binary_const(long a) {
             return (long)((a << CONST_SHIFT));
         }
    @@ -2734,8 +2785,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long128VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHLLong128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2754,8 +2803,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long128VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static long ASHR_binary_const(long a) {
             return (long)((a >> CONST_SHIFT));
         }
    @@ -2775,8 +2822,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long128VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ASHRLong128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2795,8 +2840,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long128VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static long ROR_binary_const(long a) {
             return (long)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2816,8 +2859,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long128VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void RORLong128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2836,8 +2877,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long128VectorTests::ROR_binary_const);
         }
     
    -
    -
         static long ROL_binary_const(long a) {
             return (long)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2857,8 +2896,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long128VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ROLLong128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2898,6 +2935,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long128VectorTests::MIN);
         }
    +
         static long min(long a, long b) {
             return (long)(Math.min(a, b));
         }
    @@ -2916,6 +2954,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long128VectorTests::min);
         }
    +
         static long MAX(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -2936,6 +2975,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long128VectorTests::MAX);
         }
    +
         static long max(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -3029,7 +3069,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ANDReduceLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3055,7 +3094,6 @@ public class Long128VectorTests extends AbstractVectorTest {
                     Long128VectorTests::ANDReduce, Long128VectorTests::ANDReduceAll);
         }
     
    -
         static long ANDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3075,7 +3113,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ANDReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3103,7 +3140,6 @@ public class Long128VectorTests extends AbstractVectorTest {
                     Long128VectorTests::ANDReduceMasked, Long128VectorTests::ANDReduceAllMasked);
         }
     
    -
         static long ORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3122,7 +3158,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ORReduceLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3148,7 +3183,6 @@ public class Long128VectorTests extends AbstractVectorTest {
                     Long128VectorTests::ORReduce, Long128VectorTests::ORReduceAll);
         }
     
    -
         static long ORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3168,7 +3202,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ORReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3196,7 +3229,6 @@ public class Long128VectorTests extends AbstractVectorTest {
                     Long128VectorTests::ORReduceMasked, Long128VectorTests::ORReduceAllMasked);
         }
     
    -
         static long XORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3215,7 +3247,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void XORReduceLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3241,7 +3272,6 @@ public class Long128VectorTests extends AbstractVectorTest {
                     Long128VectorTests::XORReduce, Long128VectorTests::XORReduceAll);
         }
     
    -
         static long XORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3261,7 +3291,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void XORReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3306,6 +3335,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void ADDReduceLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3330,6 +3360,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long128VectorTests::ADDReduce, Long128VectorTests::ADDReduceAll);
         }
    +
         static long ADDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3348,6 +3379,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ADDReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3374,6 +3406,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long128VectorTests::ADDReduceMasked, Long128VectorTests::ADDReduceAllMasked);
         }
    +
         static long MULReduce(long[] a, int idx) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3391,6 +3424,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MULReduceLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3415,6 +3449,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long128VectorTests::MULReduce, Long128VectorTests::MULReduceAll);
         }
    +
         static long MULReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3433,6 +3468,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MULReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3459,6 +3495,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long128VectorTests::MULReduceMasked, Long128VectorTests::MULReduceAllMasked);
         }
    +
         static long MINReduce(long[] a, int idx) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3476,6 +3513,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MINReduceLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3500,6 +3538,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long128VectorTests::MINReduce, Long128VectorTests::MINReduceAll);
         }
    +
         static long MINReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3518,6 +3557,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MINReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3544,6 +3584,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long128VectorTests::MINReduceMasked, Long128VectorTests::MINReduceAllMasked);
         }
    +
         static long MAXReduce(long[] a, int idx) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3561,6 +3602,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MAXReduceLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3585,6 +3627,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long128VectorTests::MAXReduce, Long128VectorTests::MAXReduceAll);
         }
    +
         static long MAXReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3603,6 +3646,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MAXReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3629,6 +3673,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long128VectorTests::MAXReduceMasked, Long128VectorTests::MAXReduceAllMasked);
         }
    +
         static long FIRST_NONZEROReduce(long[] a, int idx) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3646,6 +3691,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void FIRST_NONZEROReduceLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3670,6 +3716,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long128VectorTests::FIRST_NONZEROReduce, Long128VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static long FIRST_NONZEROReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3688,6 +3735,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3724,7 +3772,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueLong128VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3740,7 +3787,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Long128VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3750,7 +3796,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueLong128VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3766,7 +3811,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Long128VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void withLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3784,6 +3828,7 @@ public class Long128VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(long a) {
             return bits(a)==0;
         }
    @@ -3824,6 +3869,7 @@ public class Long128VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(long a) {
             return bits(a)<0;
         }
    @@ -3865,9 +3911,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3887,7 +3930,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3930,7 +3972,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GTLong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3973,7 +4014,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void EQLong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3993,7 +4033,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void eqLong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4036,7 +4075,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void NELong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4079,7 +4117,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LELong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4122,7 +4159,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GELong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4165,8 +4201,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LTLong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4186,8 +4220,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LTLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4211,9 +4243,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GTLong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4233,8 +4262,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GTLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4258,9 +4285,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LELong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4280,8 +4304,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LELong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4305,9 +4327,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GELong128VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4327,8 +4346,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GELong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4352,8 +4369,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLong128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4370,7 +4385,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void LTLong128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4408,7 +4422,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void EQLong128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4488,6 +4501,43 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void compressLong128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void expandLong128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void getLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4658,10 +4708,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZeroLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4676,9 +4722,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static long[] sliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4704,6 +4747,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Long128VectorTests::sliceUnary);
         }
    +
         static long[] sliceBinary(long[] a, long[] b, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4733,6 +4777,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Long128VectorTests::sliceBinary);
         }
    +
         static long[] slice(long[] a, long[] b, int origin, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4766,6 +4811,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Long128VectorTests::slice);
         }
    +
         static long[] unsliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4793,6 +4839,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Long128VectorTests::unsliceUnary);
         }
    +
         static long[] unsliceBinary(long[] a, long[] b, int origin, int part, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4832,6 +4879,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Long128VectorTests::unsliceBinary);
         }
    +
         static long[] unslice(long[] a, long[] b, int origin, int part, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4889,36 +4937,14 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Long128VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static long BITWISE_BLEND(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
    +
         static long bitwiseBlend(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4937,6 +4963,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Long128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4954,7 +4981,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Long128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4977,9 +5003,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Long128VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5009,6 +5032,7 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Long128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5039,7 +5063,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Long128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5078,9 +5101,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Long128VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5095,6 +5115,7 @@ public class Long128VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Long128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5110,7 +5131,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Long128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong128VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5129,7 +5149,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Long128VectorTests::BITWISE_BLEND);
         }
     
    -
         static long NEG(long a) {
             return (long)(-((long)a));
         }
    @@ -5242,7 +5261,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long128VectorTests::ABS);
         }
     
    -
         static long NOT(long a) {
             return (long)(~((long)a));
         }
    @@ -5251,8 +5269,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             return (long)(~((long)a));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void NOTLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5283,8 +5299,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Long128VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void NOTMaskedLong128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5303,14 +5317,10 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long128VectorTests::NOT);
         }
     
    -
    -
         static long ZOMO(long a) {
             return (long)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZOMOLong128VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5326,8 +5336,6 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Long128VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ZOMOMaskedLong128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5346,9 +5354,190 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long128VectorTests::ZOMO);
         }
     
    +    static long BIT_COUNT(long a) {
    +        return (long)(Long.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void BIT_COUNTLong128VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Long128VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedLong128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long128VectorTests::BIT_COUNT);
    +    }
    +
    +    static long TRAILING_ZEROS_COUNT(long a) {
    +        return (long)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTLong128VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long128VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedLong128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long128VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT(long a) {
    +        return (long)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTLong128VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long128VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedLong128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long128VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static long REVERSE(long a) {
    +        return (long)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSELong128VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long128VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSEMaskedLong128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long128VectorTests::REVERSE);
    +    }
    +
    +    static long REVERSE_BYTES(long a) {
    +        return (long)(Long.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSE_BYTESLong128VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long128VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedLong128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long128VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLong128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5685,6 +5874,23 @@ public class Long128VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Long128VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressLong128VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5727,6 +5933,20 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongLong128VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5747,6 +5967,14 @@ public class Long128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongLong128VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeLong128VectorTestsSmokeTest() {
             LongVector av = LongVector.zero(SPECIES);
    @@ -5809,4 +6037,3 @@ public class Long128VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java
    index c552c63e7ac..2be1356e3bd 100644
    --- a/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.LongVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.LongBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfLong ELEMENT_LAYOUT = ValueLayout.JAVA_LONG.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
     
    @@ -68,17 +70,6 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> LONG_GENERATORS = List.of(
                 withToString("long[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferProvider() {
    +    public Object[][] longMemorySegmentProvider() {
             return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferMaskProvider() {
    +    public Object[][] longMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> LONG_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] longByteArrayProvider() {
    -        return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] longByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> LONG_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] longByteProviderForIOOBE() {
             var f = LONG_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(long[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (long v : a) {
    -            bb.putLong(v);
    +    static MemorySegment toSegment(long[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static long[] bufferToArray(ByteBuffer bb) {
    -        LongBuffer db = bb.asLongBuffer();
    -        long[] d = new long[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(long[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        LongBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asLongBuffer();
    -        for (long v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static long[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "longProvider")
         static void loadStoreArray(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "longByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "longMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             long[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "longByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "longByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Long256VectorTests.java b/test/jdk/jdk/incubator/vector/Long256VectorTests.java
    index 57488c830ec..70d43652d47 100644
    --- a/test/jdk/jdk/incubator/vector/Long256VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Long256VectorTests.java
    @@ -218,6 +218,55 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (long)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (long)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(long[] r, long[] a, long[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -874,7 +923,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static long bits(long e) {
             return  e;
         }
    @@ -976,7 +1024,6 @@ public class Long256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1052,7 +1099,6 @@ public class Long256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> LONG_COMPARE_GENERATORS = List.of(
                 withToString("long[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1164,7 +1210,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return new boolean[length];
         };
     
    -
         static void replaceZero(long[] a, long v) {
             for (int i = 0; i < a.length; i++) {
                 if (a[i] == 0) {
    @@ -1189,6 +1234,18 @@ public class Long256VectorTests extends AbstractVectorTest {
             return Long.rotateRight(a, ((int)b));
         }
     
    +    static long TRAILING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfTrailingZeros(a);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfLeadingZeros(a);
    +    }
    +
    +    static long REVERSE_scalar(long a) {
    +        return Long.reverse(a);
    +    }
    +
         static boolean eq(long a, long b) {
             return a == b;
         }
    @@ -1343,6 +1400,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static long ADD(long a, long b) {
             return (long)(a + b);
         }
    @@ -1363,6 +1421,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long256VectorTests::ADD);
         }
    +
         static long add(long a, long b) {
             return (long)(a + b);
         }
    @@ -1419,6 +1478,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Long256VectorTests::add);
         }
    +
         static long SUB(long a, long b) {
             return (long)(a - b);
         }
    @@ -1439,6 +1499,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long256VectorTests::SUB);
         }
    +
         static long sub(long a, long b) {
             return (long)(a - b);
         }
    @@ -1495,6 +1556,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Long256VectorTests::sub);
         }
    +
         static long MUL(long a, long b) {
             return (long)(a * b);
         }
    @@ -1515,6 +1577,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long256VectorTests::MUL);
         }
    +
         static long mul(long a, long b) {
             return (long)(a * b);
         }
    @@ -1572,8 +1635,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::mul);
         }
     
    -
    -
         static long DIV(long a, long b) {
             return (long)(a / b);
         }
    @@ -1596,6 +1657,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long256VectorTests::DIV);
         }
    +
         static long div(long a, long b) {
             return (long)(a / b);
         }
    @@ -1619,8 +1681,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void DIVLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1726,6 +1786,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long256VectorTests::AND);
         }
    +
         static long and(long a, long b) {
             return (long)(a & b);
         }
    @@ -1745,8 +1806,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1767,7 +1826,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::AND);
         }
     
    -
         static long AND_NOT(long a, long b) {
             return (long)(a & ~b);
         }
    @@ -1789,8 +1847,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void AND_NOTLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1811,7 +1867,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::AND_NOT);
         }
     
    -
         static long OR(long a, long b) {
             return (long)(a | b);
         }
    @@ -1832,6 +1887,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long256VectorTests::OR);
         }
    +
         static long or(long a, long b) {
             return (long)(a | b);
         }
    @@ -1851,8 +1907,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1873,7 +1927,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::OR);
         }
     
    -
         static long XOR(long a, long b) {
             return (long)(a ^ b);
         }
    @@ -1895,8 +1948,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void XORLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1917,6 +1968,87 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::XOR);
         }
     
    +    static long COMPRESS_BITS(long a, long b) {
    +        return (long)(Long.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void COMPRESS_BITSLong256VectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Long256VectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void COMPRESS_BITSLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Long256VectorTests::COMPRESS_BITS);
    +    }
    +
    +    static long EXPAND_BITS(long a, long b) {
    +        return (long)(Long.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void EXPAND_BITSLong256VectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Long256VectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void EXPAND_BITSLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Long256VectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "longBinaryOpProvider")
         static void addLong256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -2011,9 +2143,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long256VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void divLong256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2030,8 +2159,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void divLong256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2051,8 +2178,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLong256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2081,8 +2206,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long256VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2100,8 +2223,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long256VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ANDLong256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2130,8 +2251,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long256VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLong256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2149,8 +2268,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long256VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLong256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2165,8 +2282,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Long256VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong256VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2184,7 +2299,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Long256VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ADDLong256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2237,8 +2351,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2259,11 +2371,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static long ASHR(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2285,8 +2392,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2307,11 +2412,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHR(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2333,8 +2433,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2355,11 +2453,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHL_unary(long a, long b) {
             return (long)((a << b));
         }
    @@ -2380,8 +2473,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long256VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLong256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2401,11 +2492,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long256VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static long LSHR_unary(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2426,8 +2512,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long256VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLong256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2447,11 +2531,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long256VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ASHR_unary(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2472,8 +2551,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long256VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLong256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2493,11 +2570,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long256VectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ROR(long a, long b) {
             return (long)(ROR_scalar(a,b));
         }
    @@ -2519,8 +2591,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2541,7 +2611,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::ROR);
         }
     
    -
         static long ROL(long a, long b) {
             return (long)(ROL_scalar(a,b));
         }
    @@ -2563,8 +2632,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long256VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2585,7 +2652,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long256VectorTests::ROL);
         }
     
    -
         static long ROR_unary(long a, long b) {
             return (long)(ROR_scalar(a, b));
         }
    @@ -2606,8 +2672,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long256VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLong256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2627,7 +2691,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long256VectorTests::ROR_unary);
         }
     
    -
         static long ROL_unary(long a, long b) {
             return (long)(ROL_scalar(a, b));
         }
    @@ -2648,8 +2711,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long256VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLong256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2668,8 +2729,6 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Long256VectorTests::ROL_unary);
         }
    -
    -
         static long LSHR_binary_const(long a) {
             return (long)((a >>> CONST_SHIFT));
         }
    @@ -2689,8 +2748,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long256VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHRLong256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2709,12 +2766,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long256VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static long LSHL_binary_const(long a) {
             return (long)((a << CONST_SHIFT));
         }
    @@ -2734,8 +2785,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long256VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHLLong256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2754,8 +2803,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long256VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static long ASHR_binary_const(long a) {
             return (long)((a >> CONST_SHIFT));
         }
    @@ -2775,8 +2822,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long256VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ASHRLong256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2795,8 +2840,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long256VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static long ROR_binary_const(long a) {
             return (long)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2816,8 +2859,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long256VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void RORLong256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2836,8 +2877,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long256VectorTests::ROR_binary_const);
         }
     
    -
    -
         static long ROL_binary_const(long a) {
             return (long)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2857,8 +2896,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long256VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ROLLong256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2898,6 +2935,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long256VectorTests::MIN);
         }
    +
         static long min(long a, long b) {
             return (long)(Math.min(a, b));
         }
    @@ -2916,6 +2954,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long256VectorTests::min);
         }
    +
         static long MAX(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -2936,6 +2975,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long256VectorTests::MAX);
         }
    +
         static long max(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -3029,7 +3069,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ANDReduceLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3055,7 +3094,6 @@ public class Long256VectorTests extends AbstractVectorTest {
                     Long256VectorTests::ANDReduce, Long256VectorTests::ANDReduceAll);
         }
     
    -
         static long ANDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3075,7 +3113,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ANDReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3103,7 +3140,6 @@ public class Long256VectorTests extends AbstractVectorTest {
                     Long256VectorTests::ANDReduceMasked, Long256VectorTests::ANDReduceAllMasked);
         }
     
    -
         static long ORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3122,7 +3158,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ORReduceLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3148,7 +3183,6 @@ public class Long256VectorTests extends AbstractVectorTest {
                     Long256VectorTests::ORReduce, Long256VectorTests::ORReduceAll);
         }
     
    -
         static long ORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3168,7 +3202,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ORReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3196,7 +3229,6 @@ public class Long256VectorTests extends AbstractVectorTest {
                     Long256VectorTests::ORReduceMasked, Long256VectorTests::ORReduceAllMasked);
         }
     
    -
         static long XORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3215,7 +3247,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void XORReduceLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3241,7 +3272,6 @@ public class Long256VectorTests extends AbstractVectorTest {
                     Long256VectorTests::XORReduce, Long256VectorTests::XORReduceAll);
         }
     
    -
         static long XORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3261,7 +3291,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void XORReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3306,6 +3335,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void ADDReduceLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3330,6 +3360,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long256VectorTests::ADDReduce, Long256VectorTests::ADDReduceAll);
         }
    +
         static long ADDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3348,6 +3379,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ADDReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3374,6 +3406,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long256VectorTests::ADDReduceMasked, Long256VectorTests::ADDReduceAllMasked);
         }
    +
         static long MULReduce(long[] a, int idx) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3391,6 +3424,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MULReduceLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3415,6 +3449,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long256VectorTests::MULReduce, Long256VectorTests::MULReduceAll);
         }
    +
         static long MULReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3433,6 +3468,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MULReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3459,6 +3495,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long256VectorTests::MULReduceMasked, Long256VectorTests::MULReduceAllMasked);
         }
    +
         static long MINReduce(long[] a, int idx) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3476,6 +3513,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MINReduceLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3500,6 +3538,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long256VectorTests::MINReduce, Long256VectorTests::MINReduceAll);
         }
    +
         static long MINReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3518,6 +3557,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MINReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3544,6 +3584,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long256VectorTests::MINReduceMasked, Long256VectorTests::MINReduceAllMasked);
         }
    +
         static long MAXReduce(long[] a, int idx) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3561,6 +3602,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MAXReduceLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3585,6 +3627,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long256VectorTests::MAXReduce, Long256VectorTests::MAXReduceAll);
         }
    +
         static long MAXReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3603,6 +3646,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MAXReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3629,6 +3673,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long256VectorTests::MAXReduceMasked, Long256VectorTests::MAXReduceAllMasked);
         }
    +
         static long FIRST_NONZEROReduce(long[] a, int idx) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3646,6 +3691,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void FIRST_NONZEROReduceLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3670,6 +3716,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long256VectorTests::FIRST_NONZEROReduce, Long256VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static long FIRST_NONZEROReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3688,6 +3735,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3724,7 +3772,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueLong256VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3740,7 +3787,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Long256VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3750,7 +3796,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueLong256VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3766,7 +3811,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Long256VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void withLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3784,6 +3828,7 @@ public class Long256VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(long a) {
             return bits(a)==0;
         }
    @@ -3824,6 +3869,7 @@ public class Long256VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(long a) {
             return bits(a)<0;
         }
    @@ -3865,9 +3911,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3887,7 +3930,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3930,7 +3972,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GTLong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3973,7 +4014,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void EQLong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3993,7 +4033,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void eqLong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4036,7 +4075,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void NELong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4079,7 +4117,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LELong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4122,7 +4159,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GELong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4165,8 +4201,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LTLong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4186,8 +4220,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LTLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4211,9 +4243,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GTLong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4233,8 +4262,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GTLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4258,9 +4285,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LELong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4280,8 +4304,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LELong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4305,9 +4327,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GELong256VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4327,8 +4346,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GELong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4352,8 +4369,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLong256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4370,7 +4385,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void LTLong256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4408,7 +4422,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void EQLong256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4488,6 +4501,43 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void compressLong256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void expandLong256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void getLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4658,10 +4708,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZeroLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4676,9 +4722,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static long[] sliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4704,6 +4747,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Long256VectorTests::sliceUnary);
         }
    +
         static long[] sliceBinary(long[] a, long[] b, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4733,6 +4777,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Long256VectorTests::sliceBinary);
         }
    +
         static long[] slice(long[] a, long[] b, int origin, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4766,6 +4811,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Long256VectorTests::slice);
         }
    +
         static long[] unsliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4793,6 +4839,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Long256VectorTests::unsliceUnary);
         }
    +
         static long[] unsliceBinary(long[] a, long[] b, int origin, int part, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4832,6 +4879,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Long256VectorTests::unsliceBinary);
         }
    +
         static long[] unslice(long[] a, long[] b, int origin, int part, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4889,36 +4937,14 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Long256VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static long BITWISE_BLEND(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
    +
         static long bitwiseBlend(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4937,6 +4963,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Long256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4954,7 +4981,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Long256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4977,9 +5003,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Long256VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5009,6 +5032,7 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Long256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5039,7 +5063,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Long256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5078,9 +5101,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Long256VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5095,6 +5115,7 @@ public class Long256VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Long256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5110,7 +5131,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Long256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong256VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5129,7 +5149,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Long256VectorTests::BITWISE_BLEND);
         }
     
    -
         static long NEG(long a) {
             return (long)(-((long)a));
         }
    @@ -5242,7 +5261,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long256VectorTests::ABS);
         }
     
    -
         static long NOT(long a) {
             return (long)(~((long)a));
         }
    @@ -5251,8 +5269,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             return (long)(~((long)a));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void NOTLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5283,8 +5299,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Long256VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void NOTMaskedLong256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5303,14 +5317,10 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long256VectorTests::NOT);
         }
     
    -
    -
         static long ZOMO(long a) {
             return (long)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZOMOLong256VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5326,8 +5336,6 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Long256VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ZOMOMaskedLong256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5346,9 +5354,190 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long256VectorTests::ZOMO);
         }
     
    +    static long BIT_COUNT(long a) {
    +        return (long)(Long.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void BIT_COUNTLong256VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Long256VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedLong256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long256VectorTests::BIT_COUNT);
    +    }
    +
    +    static long TRAILING_ZEROS_COUNT(long a) {
    +        return (long)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTLong256VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long256VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedLong256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long256VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT(long a) {
    +        return (long)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTLong256VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long256VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedLong256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long256VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static long REVERSE(long a) {
    +        return (long)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSELong256VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long256VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSEMaskedLong256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long256VectorTests::REVERSE);
    +    }
    +
    +    static long REVERSE_BYTES(long a) {
    +        return (long)(Long.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSE_BYTESLong256VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long256VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedLong256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long256VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLong256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5685,6 +5874,23 @@ public class Long256VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Long256VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressLong256VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5727,6 +5933,20 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongLong256VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5747,6 +5967,14 @@ public class Long256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongLong256VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeLong256VectorTestsSmokeTest() {
             LongVector av = LongVector.zero(SPECIES);
    @@ -5809,4 +6037,3 @@ public class Long256VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java
    index f547cb5938d..43cb1898573 100644
    --- a/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.LongVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.LongBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfLong ELEMENT_LAYOUT = ValueLayout.JAVA_LONG.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
     
    @@ -68,17 +70,6 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> LONG_GENERATORS = List.of(
                 withToString("long[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferProvider() {
    +    public Object[][] longMemorySegmentProvider() {
             return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferMaskProvider() {
    +    public Object[][] longMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> LONG_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] longByteArrayProvider() {
    -        return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] longByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> LONG_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] longByteProviderForIOOBE() {
             var f = LONG_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(long[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (long v : a) {
    -            bb.putLong(v);
    +    static MemorySegment toSegment(long[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static long[] bufferToArray(ByteBuffer bb) {
    -        LongBuffer db = bb.asLongBuffer();
    -        long[] d = new long[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(long[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        LongBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asLongBuffer();
    -        for (long v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static long[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "longProvider")
         static void loadStoreArray(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "longByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "longMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             long[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "longByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "longByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Long512VectorTests.java b/test/jdk/jdk/incubator/vector/Long512VectorTests.java
    index 31e5e49a2ff..be795187116 100644
    --- a/test/jdk/jdk/incubator/vector/Long512VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Long512VectorTests.java
    @@ -218,6 +218,55 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (long)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (long)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(long[] r, long[] a, long[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -874,7 +923,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static long bits(long e) {
             return  e;
         }
    @@ -976,7 +1024,6 @@ public class Long512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1052,7 +1099,6 @@ public class Long512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> LONG_COMPARE_GENERATORS = List.of(
                 withToString("long[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1164,7 +1210,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return new boolean[length];
         };
     
    -
         static void replaceZero(long[] a, long v) {
             for (int i = 0; i < a.length; i++) {
                 if (a[i] == 0) {
    @@ -1189,6 +1234,18 @@ public class Long512VectorTests extends AbstractVectorTest {
             return Long.rotateRight(a, ((int)b));
         }
     
    +    static long TRAILING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfTrailingZeros(a);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfLeadingZeros(a);
    +    }
    +
    +    static long REVERSE_scalar(long a) {
    +        return Long.reverse(a);
    +    }
    +
         static boolean eq(long a, long b) {
             return a == b;
         }
    @@ -1343,6 +1400,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static long ADD(long a, long b) {
             return (long)(a + b);
         }
    @@ -1363,6 +1421,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long512VectorTests::ADD);
         }
    +
         static long add(long a, long b) {
             return (long)(a + b);
         }
    @@ -1419,6 +1478,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Long512VectorTests::add);
         }
    +
         static long SUB(long a, long b) {
             return (long)(a - b);
         }
    @@ -1439,6 +1499,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long512VectorTests::SUB);
         }
    +
         static long sub(long a, long b) {
             return (long)(a - b);
         }
    @@ -1495,6 +1556,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Long512VectorTests::sub);
         }
    +
         static long MUL(long a, long b) {
             return (long)(a * b);
         }
    @@ -1515,6 +1577,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long512VectorTests::MUL);
         }
    +
         static long mul(long a, long b) {
             return (long)(a * b);
         }
    @@ -1572,8 +1635,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::mul);
         }
     
    -
    -
         static long DIV(long a, long b) {
             return (long)(a / b);
         }
    @@ -1596,6 +1657,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long512VectorTests::DIV);
         }
    +
         static long div(long a, long b) {
             return (long)(a / b);
         }
    @@ -1619,8 +1681,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void DIVLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1726,6 +1786,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long512VectorTests::AND);
         }
    +
         static long and(long a, long b) {
             return (long)(a & b);
         }
    @@ -1745,8 +1806,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1767,7 +1826,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::AND);
         }
     
    -
         static long AND_NOT(long a, long b) {
             return (long)(a & ~b);
         }
    @@ -1789,8 +1847,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void AND_NOTLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1811,7 +1867,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::AND_NOT);
         }
     
    -
         static long OR(long a, long b) {
             return (long)(a | b);
         }
    @@ -1832,6 +1887,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long512VectorTests::OR);
         }
    +
         static long or(long a, long b) {
             return (long)(a | b);
         }
    @@ -1851,8 +1907,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1873,7 +1927,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::OR);
         }
     
    -
         static long XOR(long a, long b) {
             return (long)(a ^ b);
         }
    @@ -1895,8 +1948,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void XORLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1917,6 +1968,87 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::XOR);
         }
     
    +    static long COMPRESS_BITS(long a, long b) {
    +        return (long)(Long.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void COMPRESS_BITSLong512VectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Long512VectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void COMPRESS_BITSLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Long512VectorTests::COMPRESS_BITS);
    +    }
    +
    +    static long EXPAND_BITS(long a, long b) {
    +        return (long)(Long.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void EXPAND_BITSLong512VectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Long512VectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void EXPAND_BITSLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Long512VectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "longBinaryOpProvider")
         static void addLong512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -2011,9 +2143,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long512VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void divLong512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2030,8 +2159,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void divLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2051,8 +2178,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLong512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2081,8 +2206,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long512VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2100,8 +2223,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long512VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ANDLong512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2130,8 +2251,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long512VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2149,8 +2268,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long512VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLong512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2165,8 +2282,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Long512VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong512VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2184,7 +2299,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Long512VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ADDLong512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2237,8 +2351,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2259,11 +2371,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static long ASHR(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2285,8 +2392,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2307,11 +2412,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHR(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2333,8 +2433,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2355,11 +2453,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHL_unary(long a, long b) {
             return (long)((a << b));
         }
    @@ -2380,8 +2473,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long512VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLong512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2401,11 +2492,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static long LSHR_unary(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2426,8 +2512,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long512VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLong512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2447,11 +2531,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ASHR_unary(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2472,8 +2551,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long512VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLong512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2493,11 +2570,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ROR(long a, long b) {
             return (long)(ROR_scalar(a,b));
         }
    @@ -2519,8 +2591,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2541,7 +2611,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::ROR);
         }
     
    -
         static long ROL(long a, long b) {
             return (long)(ROL_scalar(a,b));
         }
    @@ -2563,8 +2632,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long512VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2585,7 +2652,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long512VectorTests::ROL);
         }
     
    -
         static long ROR_unary(long a, long b) {
             return (long)(ROR_scalar(a, b));
         }
    @@ -2606,8 +2672,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long512VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLong512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2627,7 +2691,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::ROR_unary);
         }
     
    -
         static long ROL_unary(long a, long b) {
             return (long)(ROL_scalar(a, b));
         }
    @@ -2648,8 +2711,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long512VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLong512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2668,8 +2729,6 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::ROL_unary);
         }
    -
    -
         static long LSHR_binary_const(long a) {
             return (long)((a >>> CONST_SHIFT));
         }
    @@ -2689,8 +2748,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long512VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHRLong512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2709,12 +2766,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long512VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static long LSHL_binary_const(long a) {
             return (long)((a << CONST_SHIFT));
         }
    @@ -2734,8 +2785,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long512VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHLLong512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2754,8 +2803,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long512VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static long ASHR_binary_const(long a) {
             return (long)((a >> CONST_SHIFT));
         }
    @@ -2775,8 +2822,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long512VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ASHRLong512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2795,8 +2840,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long512VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static long ROR_binary_const(long a) {
             return (long)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2816,8 +2859,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long512VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void RORLong512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2836,8 +2877,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long512VectorTests::ROR_binary_const);
         }
     
    -
    -
         static long ROL_binary_const(long a) {
             return (long)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2857,8 +2896,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long512VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ROLLong512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2898,6 +2935,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long512VectorTests::MIN);
         }
    +
         static long min(long a, long b) {
             return (long)(Math.min(a, b));
         }
    @@ -2916,6 +2954,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long512VectorTests::min);
         }
    +
         static long MAX(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -2936,6 +2975,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long512VectorTests::MAX);
         }
    +
         static long max(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -3029,7 +3069,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ANDReduceLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3055,7 +3094,6 @@ public class Long512VectorTests extends AbstractVectorTest {
                     Long512VectorTests::ANDReduce, Long512VectorTests::ANDReduceAll);
         }
     
    -
         static long ANDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3075,7 +3113,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ANDReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3103,7 +3140,6 @@ public class Long512VectorTests extends AbstractVectorTest {
                     Long512VectorTests::ANDReduceMasked, Long512VectorTests::ANDReduceAllMasked);
         }
     
    -
         static long ORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3122,7 +3158,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ORReduceLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3148,7 +3183,6 @@ public class Long512VectorTests extends AbstractVectorTest {
                     Long512VectorTests::ORReduce, Long512VectorTests::ORReduceAll);
         }
     
    -
         static long ORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3168,7 +3202,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ORReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3196,7 +3229,6 @@ public class Long512VectorTests extends AbstractVectorTest {
                     Long512VectorTests::ORReduceMasked, Long512VectorTests::ORReduceAllMasked);
         }
     
    -
         static long XORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3215,7 +3247,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void XORReduceLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3241,7 +3272,6 @@ public class Long512VectorTests extends AbstractVectorTest {
                     Long512VectorTests::XORReduce, Long512VectorTests::XORReduceAll);
         }
     
    -
         static long XORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3261,7 +3291,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void XORReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3306,6 +3335,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void ADDReduceLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3330,6 +3360,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long512VectorTests::ADDReduce, Long512VectorTests::ADDReduceAll);
         }
    +
         static long ADDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3348,6 +3379,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ADDReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3374,6 +3406,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long512VectorTests::ADDReduceMasked, Long512VectorTests::ADDReduceAllMasked);
         }
    +
         static long MULReduce(long[] a, int idx) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3391,6 +3424,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MULReduceLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3415,6 +3449,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long512VectorTests::MULReduce, Long512VectorTests::MULReduceAll);
         }
    +
         static long MULReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3433,6 +3468,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MULReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3459,6 +3495,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long512VectorTests::MULReduceMasked, Long512VectorTests::MULReduceAllMasked);
         }
    +
         static long MINReduce(long[] a, int idx) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3476,6 +3513,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MINReduceLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3500,6 +3538,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long512VectorTests::MINReduce, Long512VectorTests::MINReduceAll);
         }
    +
         static long MINReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3518,6 +3557,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MINReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3544,6 +3584,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long512VectorTests::MINReduceMasked, Long512VectorTests::MINReduceAllMasked);
         }
    +
         static long MAXReduce(long[] a, int idx) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3561,6 +3602,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MAXReduceLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3585,6 +3627,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long512VectorTests::MAXReduce, Long512VectorTests::MAXReduceAll);
         }
    +
         static long MAXReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3603,6 +3646,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MAXReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3629,6 +3673,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long512VectorTests::MAXReduceMasked, Long512VectorTests::MAXReduceAllMasked);
         }
    +
         static long FIRST_NONZEROReduce(long[] a, int idx) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3646,6 +3691,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void FIRST_NONZEROReduceLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3670,6 +3716,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long512VectorTests::FIRST_NONZEROReduce, Long512VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static long FIRST_NONZEROReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3688,6 +3735,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3724,7 +3772,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueLong512VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3740,7 +3787,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Long512VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3750,7 +3796,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueLong512VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3766,7 +3811,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Long512VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void withLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3784,6 +3828,7 @@ public class Long512VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(long a) {
             return bits(a)==0;
         }
    @@ -3824,6 +3869,7 @@ public class Long512VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(long a) {
             return bits(a)<0;
         }
    @@ -3865,9 +3911,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3887,7 +3930,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3930,7 +3972,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GTLong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3973,7 +4014,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void EQLong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3993,7 +4033,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void eqLong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4036,7 +4075,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void NELong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4079,7 +4117,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LELong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4122,7 +4159,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GELong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4165,8 +4201,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LTLong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4186,8 +4220,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LTLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4211,9 +4243,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GTLong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4233,8 +4262,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GTLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4258,9 +4285,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LELong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4280,8 +4304,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LELong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4305,9 +4327,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GELong512VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4327,8 +4346,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GELong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4352,8 +4369,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLong512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4370,7 +4385,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void LTLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4408,7 +4422,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void EQLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4488,6 +4501,43 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void compressLong512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void expandLong512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void getLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4658,10 +4708,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZeroLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4676,9 +4722,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static long[] sliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4704,6 +4747,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Long512VectorTests::sliceUnary);
         }
    +
         static long[] sliceBinary(long[] a, long[] b, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4733,6 +4777,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Long512VectorTests::sliceBinary);
         }
    +
         static long[] slice(long[] a, long[] b, int origin, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4766,6 +4811,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Long512VectorTests::slice);
         }
    +
         static long[] unsliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4793,6 +4839,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Long512VectorTests::unsliceUnary);
         }
    +
         static long[] unsliceBinary(long[] a, long[] b, int origin, int part, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4832,6 +4879,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Long512VectorTests::unsliceBinary);
         }
    +
         static long[] unslice(long[] a, long[] b, int origin, int part, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4889,36 +4937,14 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Long512VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static long BITWISE_BLEND(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
    +
         static long bitwiseBlend(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4937,6 +4963,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Long512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4954,7 +4981,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Long512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4977,9 +5003,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Long512VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5009,6 +5032,7 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Long512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5039,7 +5063,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Long512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5078,9 +5101,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Long512VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5095,6 +5115,7 @@ public class Long512VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Long512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5110,7 +5131,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Long512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong512VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5129,7 +5149,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Long512VectorTests::BITWISE_BLEND);
         }
     
    -
         static long NEG(long a) {
             return (long)(-((long)a));
         }
    @@ -5242,7 +5261,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long512VectorTests::ABS);
         }
     
    -
         static long NOT(long a) {
             return (long)(~((long)a));
         }
    @@ -5251,8 +5269,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             return (long)(~((long)a));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void NOTLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5283,8 +5299,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Long512VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void NOTMaskedLong512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5303,14 +5317,10 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long512VectorTests::NOT);
         }
     
    -
    -
         static long ZOMO(long a) {
             return (long)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZOMOLong512VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5326,8 +5336,6 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Long512VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ZOMOMaskedLong512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5346,9 +5354,190 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long512VectorTests::ZOMO);
         }
     
    +    static long BIT_COUNT(long a) {
    +        return (long)(Long.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void BIT_COUNTLong512VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Long512VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedLong512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long512VectorTests::BIT_COUNT);
    +    }
    +
    +    static long TRAILING_ZEROS_COUNT(long a) {
    +        return (long)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTLong512VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long512VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedLong512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long512VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT(long a) {
    +        return (long)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTLong512VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long512VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedLong512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long512VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static long REVERSE(long a) {
    +        return (long)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSELong512VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long512VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSEMaskedLong512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long512VectorTests::REVERSE);
    +    }
    +
    +    static long REVERSE_BYTES(long a) {
    +        return (long)(Long.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSE_BYTESLong512VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long512VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedLong512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long512VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLong512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5685,6 +5874,23 @@ public class Long512VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Long512VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressLong512VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5727,6 +5933,20 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongLong512VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5747,6 +5967,14 @@ public class Long512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongLong512VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeLong512VectorTestsSmokeTest() {
             LongVector av = LongVector.zero(SPECIES);
    @@ -5809,4 +6037,3 @@ public class Long512VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java
    index 42ead441191..48a3e94bbbb 100644
    --- a/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.LongVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.LongBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfLong ELEMENT_LAYOUT = ValueLayout.JAVA_LONG.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
     
    @@ -68,17 +70,6 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> LONG_GENERATORS = List.of(
                 withToString("long[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferProvider() {
    +    public Object[][] longMemorySegmentProvider() {
             return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferMaskProvider() {
    +    public Object[][] longMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> LONG_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] longByteArrayProvider() {
    -        return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] longByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> LONG_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] longByteProviderForIOOBE() {
             var f = LONG_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(long[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (long v : a) {
    -            bb.putLong(v);
    +    static MemorySegment toSegment(long[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static long[] bufferToArray(ByteBuffer bb) {
    -        LongBuffer db = bb.asLongBuffer();
    -        long[] d = new long[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(long[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        LongBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asLongBuffer();
    -        for (long v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static long[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "longProvider")
         static void loadStoreArray(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "longByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "longMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             long[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "longByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "longByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Long64VectorTests.java b/test/jdk/jdk/incubator/vector/Long64VectorTests.java
    index dacdbf4f5ce..68361979490 100644
    --- a/test/jdk/jdk/incubator/vector/Long64VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Long64VectorTests.java
    @@ -218,6 +218,55 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (long)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (long)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(long[] r, long[] a, long[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -874,7 +923,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static long bits(long e) {
             return  e;
         }
    @@ -976,7 +1024,6 @@ public class Long64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1052,7 +1099,6 @@ public class Long64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> LONG_COMPARE_GENERATORS = List.of(
                 withToString("long[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1164,7 +1210,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return new boolean[length];
         };
     
    -
         static void replaceZero(long[] a, long v) {
             for (int i = 0; i < a.length; i++) {
                 if (a[i] == 0) {
    @@ -1189,6 +1234,18 @@ public class Long64VectorTests extends AbstractVectorTest {
             return Long.rotateRight(a, ((int)b));
         }
     
    +    static long TRAILING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfTrailingZeros(a);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfLeadingZeros(a);
    +    }
    +
    +    static long REVERSE_scalar(long a) {
    +        return Long.reverse(a);
    +    }
    +
         static boolean eq(long a, long b) {
             return a == b;
         }
    @@ -1343,6 +1400,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static long ADD(long a, long b) {
             return (long)(a + b);
         }
    @@ -1363,6 +1421,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long64VectorTests::ADD);
         }
    +
         static long add(long a, long b) {
             return (long)(a + b);
         }
    @@ -1419,6 +1478,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Long64VectorTests::add);
         }
    +
         static long SUB(long a, long b) {
             return (long)(a - b);
         }
    @@ -1439,6 +1499,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long64VectorTests::SUB);
         }
    +
         static long sub(long a, long b) {
             return (long)(a - b);
         }
    @@ -1495,6 +1556,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Long64VectorTests::sub);
         }
    +
         static long MUL(long a, long b) {
             return (long)(a * b);
         }
    @@ -1515,6 +1577,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long64VectorTests::MUL);
         }
    +
         static long mul(long a, long b) {
             return (long)(a * b);
         }
    @@ -1572,8 +1635,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::mul);
         }
     
    -
    -
         static long DIV(long a, long b) {
             return (long)(a / b);
         }
    @@ -1596,6 +1657,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long64VectorTests::DIV);
         }
    +
         static long div(long a, long b) {
             return (long)(a / b);
         }
    @@ -1619,8 +1681,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void DIVLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1726,6 +1786,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long64VectorTests::AND);
         }
    +
         static long and(long a, long b) {
             return (long)(a & b);
         }
    @@ -1745,8 +1806,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1767,7 +1826,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::AND);
         }
     
    -
         static long AND_NOT(long a, long b) {
             return (long)(a & ~b);
         }
    @@ -1789,8 +1847,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void AND_NOTLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1811,7 +1867,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::AND_NOT);
         }
     
    -
         static long OR(long a, long b) {
             return (long)(a | b);
         }
    @@ -1832,6 +1887,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long64VectorTests::OR);
         }
    +
         static long or(long a, long b) {
             return (long)(a | b);
         }
    @@ -1851,8 +1907,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1873,7 +1927,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::OR);
         }
     
    -
         static long XOR(long a, long b) {
             return (long)(a ^ b);
         }
    @@ -1895,8 +1948,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void XORLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1917,6 +1968,87 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::XOR);
         }
     
    +    static long COMPRESS_BITS(long a, long b) {
    +        return (long)(Long.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void COMPRESS_BITSLong64VectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Long64VectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void COMPRESS_BITSLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Long64VectorTests::COMPRESS_BITS);
    +    }
    +
    +    static long EXPAND_BITS(long a, long b) {
    +        return (long)(Long.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void EXPAND_BITSLong64VectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, Long64VectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void EXPAND_BITSLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, Long64VectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "longBinaryOpProvider")
         static void addLong64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -2011,9 +2143,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long64VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void divLong64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2030,8 +2159,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void divLong64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2051,8 +2178,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLong64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2081,8 +2206,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long64VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2100,8 +2223,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long64VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ANDLong64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2130,8 +2251,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Long64VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLong64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2149,8 +2268,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Long64VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLong64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2165,8 +2282,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Long64VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLong64VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2184,7 +2299,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Long64VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ADDLong64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2237,8 +2351,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2259,11 +2371,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static long ASHR(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2285,8 +2392,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2307,11 +2412,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHR(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2333,8 +2433,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2355,11 +2453,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHL_unary(long a, long b) {
             return (long)((a << b));
         }
    @@ -2380,8 +2473,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long64VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLong64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2401,11 +2492,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long64VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static long LSHR_unary(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2426,8 +2512,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long64VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLong64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2447,11 +2531,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long64VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ASHR_unary(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2472,8 +2551,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long64VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLong64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2493,11 +2570,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long64VectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ROR(long a, long b) {
             return (long)(ROR_scalar(a,b));
         }
    @@ -2519,8 +2591,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2541,7 +2611,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::ROR);
         }
     
    -
         static long ROL(long a, long b) {
             return (long)(ROL_scalar(a,b));
         }
    @@ -2563,8 +2632,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Long64VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2585,7 +2652,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Long64VectorTests::ROL);
         }
     
    -
         static long ROR_unary(long a, long b) {
             return (long)(ROR_scalar(a, b));
         }
    @@ -2606,8 +2672,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long64VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLong64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2627,7 +2691,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Long64VectorTests::ROR_unary);
         }
     
    -
         static long ROL_unary(long a, long b) {
             return (long)(ROL_scalar(a, b));
         }
    @@ -2648,8 +2711,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Long64VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLong64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2668,8 +2729,6 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Long64VectorTests::ROL_unary);
         }
    -
    -
         static long LSHR_binary_const(long a) {
             return (long)((a >>> CONST_SHIFT));
         }
    @@ -2689,8 +2748,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long64VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHRLong64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2709,12 +2766,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long64VectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static long LSHL_binary_const(long a) {
             return (long)((a << CONST_SHIFT));
         }
    @@ -2734,8 +2785,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long64VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHLLong64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2754,8 +2803,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long64VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static long ASHR_binary_const(long a) {
             return (long)((a >> CONST_SHIFT));
         }
    @@ -2775,8 +2822,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long64VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ASHRLong64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2795,8 +2840,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long64VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static long ROR_binary_const(long a) {
             return (long)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2816,8 +2859,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long64VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void RORLong64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2836,8 +2877,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Long64VectorTests::ROR_binary_const);
         }
     
    -
    -
         static long ROL_binary_const(long a) {
             return (long)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2857,8 +2896,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Long64VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ROLLong64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2898,6 +2935,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long64VectorTests::MIN);
         }
    +
         static long min(long a, long b) {
             return (long)(Math.min(a, b));
         }
    @@ -2916,6 +2954,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long64VectorTests::min);
         }
    +
         static long MAX(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -2936,6 +2975,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Long64VectorTests::MAX);
         }
    +
         static long max(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -3029,7 +3069,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ANDReduceLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3055,7 +3094,6 @@ public class Long64VectorTests extends AbstractVectorTest {
                     Long64VectorTests::ANDReduce, Long64VectorTests::ANDReduceAll);
         }
     
    -
         static long ANDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3075,7 +3113,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ANDReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3103,7 +3140,6 @@ public class Long64VectorTests extends AbstractVectorTest {
                     Long64VectorTests::ANDReduceMasked, Long64VectorTests::ANDReduceAllMasked);
         }
     
    -
         static long ORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3122,7 +3158,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ORReduceLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3148,7 +3183,6 @@ public class Long64VectorTests extends AbstractVectorTest {
                     Long64VectorTests::ORReduce, Long64VectorTests::ORReduceAll);
         }
     
    -
         static long ORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3168,7 +3202,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ORReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3196,7 +3229,6 @@ public class Long64VectorTests extends AbstractVectorTest {
                     Long64VectorTests::ORReduceMasked, Long64VectorTests::ORReduceAllMasked);
         }
     
    -
         static long XORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3215,7 +3247,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void XORReduceLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3241,7 +3272,6 @@ public class Long64VectorTests extends AbstractVectorTest {
                     Long64VectorTests::XORReduce, Long64VectorTests::XORReduceAll);
         }
     
    -
         static long XORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3261,7 +3291,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void XORReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3306,6 +3335,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void ADDReduceLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3330,6 +3360,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long64VectorTests::ADDReduce, Long64VectorTests::ADDReduceAll);
         }
    +
         static long ADDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3348,6 +3379,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ADDReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3374,6 +3406,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long64VectorTests::ADDReduceMasked, Long64VectorTests::ADDReduceAllMasked);
         }
    +
         static long MULReduce(long[] a, int idx) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3391,6 +3424,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MULReduceLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3415,6 +3449,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long64VectorTests::MULReduce, Long64VectorTests::MULReduceAll);
         }
    +
         static long MULReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3433,6 +3468,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MULReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3459,6 +3495,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long64VectorTests::MULReduceMasked, Long64VectorTests::MULReduceAllMasked);
         }
    +
         static long MINReduce(long[] a, int idx) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3476,6 +3513,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MINReduceLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3500,6 +3538,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long64VectorTests::MINReduce, Long64VectorTests::MINReduceAll);
         }
    +
         static long MINReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3518,6 +3557,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MINReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3544,6 +3584,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long64VectorTests::MINReduceMasked, Long64VectorTests::MINReduceAllMasked);
         }
    +
         static long MAXReduce(long[] a, int idx) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3561,6 +3602,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MAXReduceLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3585,6 +3627,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long64VectorTests::MAXReduce, Long64VectorTests::MAXReduceAll);
         }
    +
         static long MAXReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3603,6 +3646,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MAXReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3629,6 +3673,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Long64VectorTests::MAXReduceMasked, Long64VectorTests::MAXReduceAllMasked);
         }
    +
         static long FIRST_NONZEROReduce(long[] a, int idx) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3646,6 +3691,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void FIRST_NONZEROReduceLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3670,6 +3716,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Long64VectorTests::FIRST_NONZEROReduce, Long64VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static long FIRST_NONZEROReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3688,6 +3735,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3724,7 +3772,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueLong64VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3740,7 +3787,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Long64VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3750,7 +3796,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueLong64VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3766,7 +3811,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Long64VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void withLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3784,6 +3828,7 @@ public class Long64VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(long a) {
             return bits(a)==0;
         }
    @@ -3824,6 +3869,7 @@ public class Long64VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(long a) {
             return bits(a)<0;
         }
    @@ -3865,9 +3911,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3887,7 +3930,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3930,7 +3972,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GTLong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3973,7 +4014,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void EQLong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3993,7 +4033,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void eqLong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4036,7 +4075,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void NELong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4079,7 +4117,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LELong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4122,7 +4159,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GELong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4165,8 +4201,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LTLong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4186,8 +4220,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LTLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4211,9 +4243,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GTLong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4233,8 +4262,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GTLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4258,9 +4285,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LELong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4280,8 +4304,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LELong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4305,9 +4327,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GELong64VectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4327,8 +4346,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GELong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4352,8 +4369,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLong64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4370,7 +4385,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void LTLong64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4408,7 +4422,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void EQLong64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4488,6 +4501,43 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void compressLong64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void expandLong64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void getLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4658,10 +4708,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZeroLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4676,9 +4722,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static long[] sliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4704,6 +4747,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Long64VectorTests::sliceUnary);
         }
    +
         static long[] sliceBinary(long[] a, long[] b, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4733,6 +4777,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Long64VectorTests::sliceBinary);
         }
    +
         static long[] slice(long[] a, long[] b, int origin, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4766,6 +4811,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Long64VectorTests::slice);
         }
    +
         static long[] unsliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4793,6 +4839,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Long64VectorTests::unsliceUnary);
         }
    +
         static long[] unsliceBinary(long[] a, long[] b, int origin, int part, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4832,6 +4879,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Long64VectorTests::unsliceBinary);
         }
    +
         static long[] unslice(long[] a, long[] b, int origin, int part, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4889,36 +4937,14 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Long64VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static long BITWISE_BLEND(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
    +
         static long bitwiseBlend(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4937,6 +4963,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Long64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4954,7 +4981,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Long64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4977,9 +5003,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Long64VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5009,6 +5032,7 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Long64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5039,7 +5063,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Long64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5078,9 +5101,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Long64VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLong64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5095,6 +5115,7 @@ public class Long64VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Long64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLong64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5110,7 +5131,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Long64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLong64VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5129,7 +5149,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Long64VectorTests::BITWISE_BLEND);
         }
     
    -
         static long NEG(long a) {
             return (long)(-((long)a));
         }
    @@ -5242,7 +5261,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long64VectorTests::ABS);
         }
     
    -
         static long NOT(long a) {
             return (long)(~((long)a));
         }
    @@ -5251,8 +5269,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             return (long)(~((long)a));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void NOTLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5283,8 +5299,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Long64VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void NOTMaskedLong64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5303,14 +5317,10 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long64VectorTests::NOT);
         }
     
    -
    -
         static long ZOMO(long a) {
             return (long)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZOMOLong64VectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5326,8 +5336,6 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Long64VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ZOMOMaskedLong64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5346,9 +5354,190 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Long64VectorTests::ZOMO);
         }
     
    +    static long BIT_COUNT(long a) {
    +        return (long)(Long.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void BIT_COUNTLong64VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Long64VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedLong64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long64VectorTests::BIT_COUNT);
    +    }
    +
    +    static long TRAILING_ZEROS_COUNT(long a) {
    +        return (long)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTLong64VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long64VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedLong64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long64VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT(long a) {
    +        return (long)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTLong64VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long64VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedLong64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long64VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static long REVERSE(long a) {
    +        return (long)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSELong64VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long64VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSEMaskedLong64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long64VectorTests::REVERSE);
    +    }
    +
    +    static long REVERSE_BYTES(long a) {
    +        return (long)(Long.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSE_BYTESLong64VectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Long64VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedLong64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Long64VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLong64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5685,6 +5874,23 @@ public class Long64VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Long64VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressLong64VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5727,6 +5933,20 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongLong64VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5747,6 +5967,14 @@ public class Long64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongLong64VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeLong64VectorTestsSmokeTest() {
             LongVector av = LongVector.zero(SPECIES);
    @@ -5809,4 +6037,3 @@ public class Long64VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java
    index cf08e771a8d..e21cedfae09 100644
    --- a/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java
    @@ -32,6 +32,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.LongVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorShape;
    @@ -42,12 +45,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.lang.invoke.MethodHandles;
    -import java.lang.invoke.VarHandle;
    -import java.nio.ByteBuffer;
    -import java.nio.LongBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -58,6 +56,8 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfLong ELEMENT_LAYOUT = ValueLayout.JAVA_LONG.withBitAlignment(8);
    +
         static VectorShape getMaxBit() {
             return VectorShape.S_Max_BIT;
         }
    @@ -77,17 +77,6 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> LONG_GENERATORS = List.of(
                 withToString("long[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -127,7 +116,7 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -198,9 +187,9 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferProvider() {
    +    public Object[][] longMemorySegmentProvider() {
             return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -208,35 +197,16 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] longByteBufferMaskProvider() {
    +    public Object[][] longMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> LONG_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] longByteArrayProvider() {
    -        return LONG_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] longByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> LONG_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] longByteProviderForIOOBE() {
             var f = LONG_GENERATORS.get(0);
    @@ -256,28 +226,16 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(long[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (long v : a) {
    -            bb.putLong(v);
    +    static MemorySegment toSegment(long[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static long[] bufferToArray(ByteBuffer bb) {
    -        LongBuffer db = bb.asLongBuffer();
    -        long[] d = new long[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(long[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        LongBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asLongBuffer();
    -        for (long v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static long[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -317,46 +275,25 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static LongVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static LongVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return LongVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(LongVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(LongVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static LongVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return LongVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(LongVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "longProvider")
         static void loadStoreArray(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -527,48 +464,45 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -580,25 +514,25 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -609,70 +543,61 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "longByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "longMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             long[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                LongVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -684,27 +609,27 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Long.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Long.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                LongVector av = LongVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            LongVector av = LongVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            LongVector av = LongVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -715,214 +640,36 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "longMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "longByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "longByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "longByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "longByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                LongVector av = LongVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            LongVector av = LongVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -937,6 +684,7 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java
    index 85d29f76005..26dbf89b2ee 100644
    --- a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java
    @@ -223,6 +223,55 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (long)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (long)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(long[] r, long[] a, long[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -879,7 +928,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static long bits(long e) {
             return  e;
         }
    @@ -981,7 +1029,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1057,7 +1104,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> LONG_COMPARE_GENERATORS = List.of(
                 withToString("long[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1169,7 +1215,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return new boolean[length];
         };
     
    -
         static void replaceZero(long[] a, long v) {
             for (int i = 0; i < a.length; i++) {
                 if (a[i] == 0) {
    @@ -1194,6 +1239,18 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return Long.rotateRight(a, ((int)b));
         }
     
    +    static long TRAILING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfTrailingZeros(a);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT_scalar(long a) {
    +        return Long.numberOfLeadingZeros(a);
    +    }
    +
    +    static long REVERSE_scalar(long a) {
    +        return Long.reverse(a);
    +    }
    +
         static boolean eq(long a, long b) {
             return a == b;
         }
    @@ -1348,6 +1405,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static long ADD(long a, long b) {
             return (long)(a + b);
         }
    @@ -1368,6 +1426,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, LongMaxVectorTests::ADD);
         }
    +
         static long add(long a, long b) {
             return (long)(a + b);
         }
    @@ -1424,6 +1483,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::add);
         }
    +
         static long SUB(long a, long b) {
             return (long)(a - b);
         }
    @@ -1444,6 +1504,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, LongMaxVectorTests::SUB);
         }
    +
         static long sub(long a, long b) {
             return (long)(a - b);
         }
    @@ -1500,6 +1561,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::sub);
         }
    +
         static long MUL(long a, long b) {
             return (long)(a * b);
         }
    @@ -1520,6 +1582,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, LongMaxVectorTests::MUL);
         }
    +
         static long mul(long a, long b) {
             return (long)(a * b);
         }
    @@ -1577,8 +1640,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::mul);
         }
     
    -
    -
         static long DIV(long a, long b) {
             return (long)(a / b);
         }
    @@ -1601,6 +1662,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, LongMaxVectorTests::DIV);
         }
    +
         static long div(long a, long b) {
             return (long)(a / b);
         }
    @@ -1624,8 +1686,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void DIVLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1731,6 +1791,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, LongMaxVectorTests::AND);
         }
    +
         static long and(long a, long b) {
             return (long)(a & b);
         }
    @@ -1750,8 +1811,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1772,7 +1831,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::AND);
         }
     
    -
         static long AND_NOT(long a, long b) {
             return (long)(a & ~b);
         }
    @@ -1794,8 +1852,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void AND_NOTLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1816,7 +1872,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::AND_NOT);
         }
     
    -
         static long OR(long a, long b) {
             return (long)(a | b);
         }
    @@ -1837,6 +1892,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, LongMaxVectorTests::OR);
         }
    +
         static long or(long a, long b) {
             return (long)(a | b);
         }
    @@ -1856,8 +1912,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1878,7 +1932,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::OR);
         }
     
    -
         static long XOR(long a, long b) {
             return (long)(a ^ b);
         }
    @@ -1900,8 +1953,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void XORLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1922,6 +1973,87 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::XOR);
         }
     
    +    static long COMPRESS_BITS(long a, long b) {
    +        return (long)(Long.compress(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void COMPRESS_BITSLongMaxVectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, LongMaxVectorTests::COMPRESS_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void COMPRESS_BITSLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, LongMaxVectorTests::COMPRESS_BITS);
    +    }
    +
    +    static long EXPAND_BITS(long a, long b) {
    +        return (long)(Long.expand(a, b));
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpProvider")
    +    static void EXPAND_BITSLongMaxVectorTests(IntFunction fa, IntFunction fb) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, LongMaxVectorTests::EXPAND_BITS);
    +    }
    +
    +    @Test(dataProvider = "longBinaryOpMaskProvider")
    +    static void EXPAND_BITSLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
    +                                          IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] b = fb.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                LongVector bv = LongVector.fromArray(SPECIES, b, i);
    +                av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, b, mask, LongMaxVectorTests::EXPAND_BITS);
    +    }
     
         @Test(dataProvider = "longBinaryOpProvider")
         static void addLongMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -2016,9 +2148,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void divLongMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2035,8 +2164,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void divLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2056,8 +2183,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLongMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2086,8 +2211,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2105,8 +2228,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ANDLongMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2135,8 +2256,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, LongMaxVectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ANDLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2154,8 +2273,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, LongMaxVectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ORLongMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2170,8 +2287,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, LongMaxVectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ORLongMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2189,7 +2304,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, LongMaxVectorTests::OR);
         }
     
    -
         @Test(dataProvider = "longBinaryOpProvider")
         static void ADDLongMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -2242,8 +2356,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2264,11 +2376,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static long ASHR(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2290,8 +2397,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2312,11 +2417,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHR(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2338,8 +2438,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2360,11 +2458,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static long LSHL_unary(long a, long b) {
             return (long)((a << b));
         }
    @@ -2385,8 +2478,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, LongMaxVectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHLLongMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2406,11 +2497,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static long LSHR_unary(long a, long b) {
             return (long)((a >>> b));
         }
    @@ -2431,8 +2517,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, LongMaxVectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void LSHRLongMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2452,11 +2536,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ASHR_unary(long a, long b) {
             return (long)((a >> b));
         }
    @@ -2477,8 +2556,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, LongMaxVectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ASHRLongMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2498,11 +2575,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::ASHR_unary);
         }
     
    -
    -
    -
    -
    -
         static long ROR(long a, long b) {
             return (long)(ROR_scalar(a,b));
         }
    @@ -2524,8 +2596,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2546,7 +2616,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ROR);
         }
     
    -
         static long ROL(long a, long b) {
             return (long)(ROL_scalar(a,b));
         }
    @@ -2568,8 +2637,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, LongMaxVectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2590,7 +2657,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, LongMaxVectorTests::ROL);
         }
     
    -
         static long ROR_unary(long a, long b) {
             return (long)(ROR_scalar(a, b));
         }
    @@ -2611,8 +2677,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, LongMaxVectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void RORLongMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2632,7 +2696,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::ROR_unary);
         }
     
    -
         static long ROL_unary(long a, long b) {
             return (long)(ROL_scalar(a, b));
         }
    @@ -2653,8 +2716,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, LongMaxVectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "longBinaryOpMaskProvider")
         static void ROLLongMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2673,8 +2734,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, LongMaxVectorTests::ROL_unary);
         }
    -
    -
         static long LSHR_binary_const(long a) {
             return (long)((a >>> CONST_SHIFT));
         }
    @@ -2694,8 +2753,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, LongMaxVectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHRLongMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2714,12 +2771,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, LongMaxVectorTests::LSHR_binary_const);
         }
     
    -
    -
    -
    -
    -
    -
         static long LSHL_binary_const(long a) {
             return (long)((a << CONST_SHIFT));
         }
    @@ -2739,8 +2790,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, LongMaxVectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void LSHLLongMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2759,8 +2808,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, LongMaxVectorTests::LSHL_binary_const);
         }
     
    -
    -
         static long ASHR_binary_const(long a) {
             return (long)((a >> CONST_SHIFT));
         }
    @@ -2780,8 +2827,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, LongMaxVectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ASHRLongMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2800,8 +2845,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, LongMaxVectorTests::ASHR_binary_const);
         }
     
    -
    -
         static long ROR_binary_const(long a) {
             return (long)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2821,8 +2864,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, LongMaxVectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void RORLongMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2841,8 +2882,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, LongMaxVectorTests::ROR_binary_const);
         }
     
    -
    -
         static long ROL_binary_const(long a) {
             return (long)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2862,8 +2901,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, LongMaxVectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ROLLongMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2903,6 +2940,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, LongMaxVectorTests::MIN);
         }
    +
         static long min(long a, long b) {
             return (long)(Math.min(a, b));
         }
    @@ -2921,6 +2959,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, LongMaxVectorTests::min);
         }
    +
         static long MAX(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -2941,6 +2980,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, LongMaxVectorTests::MAX);
         }
    +
         static long max(long a, long b) {
             return (long)(Math.max(a, b));
         }
    @@ -3034,7 +3074,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ANDReduceLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3060,7 +3099,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
                     LongMaxVectorTests::ANDReduce, LongMaxVectorTests::ANDReduceAll);
         }
     
    -
         static long ANDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3080,7 +3118,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ANDReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3108,7 +3145,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
                     LongMaxVectorTests::ANDReduceMasked, LongMaxVectorTests::ANDReduceAllMasked);
         }
     
    -
         static long ORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3127,7 +3163,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ORReduceLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3153,7 +3188,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
                     LongMaxVectorTests::ORReduce, LongMaxVectorTests::ORReduceAll);
         }
     
    -
         static long ORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3173,7 +3207,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ORReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3201,7 +3234,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
                     LongMaxVectorTests::ORReduceMasked, LongMaxVectorTests::ORReduceAllMasked);
         }
     
    -
         static long XORReduce(long[] a, int idx) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3220,7 +3252,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void XORReduceLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3246,7 +3277,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
                     LongMaxVectorTests::XORReduce, LongMaxVectorTests::XORReduceAll);
         }
     
    -
         static long XORReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3266,7 +3296,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void XORReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3311,6 +3340,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void ADDReduceLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3335,6 +3365,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     LongMaxVectorTests::ADDReduce, LongMaxVectorTests::ADDReduceAll);
         }
    +
         static long ADDReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3353,6 +3384,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ADDReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3379,6 +3411,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     LongMaxVectorTests::ADDReduceMasked, LongMaxVectorTests::ADDReduceAllMasked);
         }
    +
         static long MULReduce(long[] a, int idx) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3396,6 +3429,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MULReduceLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3420,6 +3454,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     LongMaxVectorTests::MULReduce, LongMaxVectorTests::MULReduceAll);
         }
    +
         static long MULReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3438,6 +3473,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MULReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3464,6 +3500,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     LongMaxVectorTests::MULReduceMasked, LongMaxVectorTests::MULReduceAllMasked);
         }
    +
         static long MINReduce(long[] a, int idx) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3481,6 +3518,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MINReduceLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3505,6 +3543,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     LongMaxVectorTests::MINReduce, LongMaxVectorTests::MINReduceAll);
         }
    +
         static long MINReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3523,6 +3562,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MINReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3549,6 +3589,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     LongMaxVectorTests::MINReduceMasked, LongMaxVectorTests::MINReduceAllMasked);
         }
    +
         static long MAXReduce(long[] a, int idx) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3566,6 +3607,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void MAXReduceLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3590,6 +3632,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     LongMaxVectorTests::MAXReduce, LongMaxVectorTests::MAXReduceAll);
         }
    +
         static long MAXReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = Long.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3608,6 +3651,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void MAXReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3634,6 +3678,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     LongMaxVectorTests::MAXReduceMasked, LongMaxVectorTests::MAXReduceAllMasked);
         }
    +
         static long FIRST_NONZEROReduce(long[] a, int idx) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3651,6 +3696,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void FIRST_NONZEROReduceLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3675,6 +3721,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     LongMaxVectorTests::FIRST_NONZEROReduce, LongMaxVectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static long FIRST_NONZEROReduceMasked(long[] a, int idx, boolean[] mask) {
             long res = (long) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3693,6 +3740,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3729,7 +3777,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueLongMaxVectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3745,7 +3792,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, LongMaxVectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3755,7 +3801,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueLongMaxVectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3771,7 +3816,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, LongMaxVectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void withLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3789,6 +3833,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(long a) {
             return bits(a)==0;
         }
    @@ -3829,6 +3874,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(long a) {
             return bits(a)<0;
         }
    @@ -3870,9 +3916,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3892,7 +3935,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3935,7 +3977,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GTLongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3978,7 +4019,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void EQLongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -3998,7 +4038,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void eqLongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4041,7 +4080,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void NELongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4084,7 +4122,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LELongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4127,7 +4164,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void GELongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4170,8 +4206,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LTLongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4191,8 +4225,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LTLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4216,9 +4248,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GTLongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4238,8 +4267,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GTLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4263,9 +4290,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_LELongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4285,8 +4309,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_LELongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4310,9 +4332,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void UNSIGNED_GELongMaxVectorTests(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4332,8 +4351,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void UNSIGNED_GELongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4357,8 +4374,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "longCompareOpProvider")
         static void LTLongMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4375,7 +4390,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void LTLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4413,7 +4427,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "longCompareOpMaskProvider")
         static void EQLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4493,6 +4506,43 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void compressLongMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void expandLongMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "longUnaryOpProvider")
         static void getLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4663,10 +4713,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZeroLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4681,9 +4727,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static long[] sliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4709,6 +4752,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, LongMaxVectorTests::sliceUnary);
         }
    +
         static long[] sliceBinary(long[] a, long[] b, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4738,6 +4782,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, LongMaxVectorTests::sliceBinary);
         }
    +
         static long[] slice(long[] a, long[] b, int origin, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4771,6 +4816,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, LongMaxVectorTests::slice);
         }
    +
         static long[] unsliceUnary(long[] a, int origin, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4798,6 +4844,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, LongMaxVectorTests::unsliceUnary);
         }
    +
         static long[] unsliceBinary(long[] a, long[] b, int origin, int part, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4837,6 +4884,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, LongMaxVectorTests::unsliceBinary);
         }
    +
         static long[] unslice(long[] a, long[] b, int origin, int part, boolean[] mask, int idx) {
             long[] res = new long[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4894,36 +4942,14 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, LongMaxVectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static long BITWISE_BLEND(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
    +
         static long bitwiseBlend(long a, long b, long c) {
             return (long)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLongMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4942,6 +4968,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLongMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -4959,7 +4986,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLongMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -4982,9 +5008,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLongMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5014,6 +5037,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLongMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5044,7 +5068,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLongMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5083,9 +5106,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "longTernaryOpProvider")
         static void BITWISE_BLENDLongMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5100,6 +5120,7 @@ public class LongMaxVectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "longTernaryOpProvider")
         static void bitwiseBlendLongMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5115,7 +5136,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, LongMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "longTernaryOpMaskProvider")
         static void BITWISE_BLENDLongMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5134,7 +5154,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, LongMaxVectorTests::BITWISE_BLEND);
         }
     
    -
         static long NEG(long a) {
             return (long)(-((long)a));
         }
    @@ -5247,7 +5266,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, LongMaxVectorTests::ABS);
         }
     
    -
         static long NOT(long a) {
             return (long)(~((long)a));
         }
    @@ -5256,8 +5274,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             return (long)(~((long)a));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void NOTLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5288,8 +5304,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, LongMaxVectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void NOTMaskedLongMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5308,14 +5322,10 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, LongMaxVectorTests::NOT);
         }
     
    -
    -
         static long ZOMO(long a) {
             return (long)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpProvider")
         static void ZOMOLongMaxVectorTests(IntFunction fa) {
             long[] a = fa.apply(SPECIES.length());
    @@ -5331,8 +5341,6 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, LongMaxVectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "longUnaryOpMaskProvider")
         static void ZOMOMaskedLongMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5351,9 +5359,190 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, LongMaxVectorTests::ZOMO);
         }
     
    +    static long BIT_COUNT(long a) {
    +        return (long)(Long.bitCount(a));
    +    }
     
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void BIT_COUNTLongMaxVectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, LongMaxVectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedLongMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, LongMaxVectorTests::BIT_COUNT);
    +    }
    +
    +    static long TRAILING_ZEROS_COUNT(long a) {
    +        return (long)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTLongMaxVectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, LongMaxVectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedLongMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, LongMaxVectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static long LEADING_ZEROS_COUNT(long a) {
    +        return (long)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTLongMaxVectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, LongMaxVectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedLongMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, LongMaxVectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static long REVERSE(long a) {
    +        return (long)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSELongMaxVectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, LongMaxVectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSEMaskedLongMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, LongMaxVectorTests::REVERSE);
    +    }
    +
    +    static long REVERSE_BYTES(long a) {
    +        return (long)(Long.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpProvider")
    +    static void REVERSE_BYTESLongMaxVectorTests(IntFunction fa) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, LongMaxVectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "longUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedLongMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        long[] a = fa.apply(SPECIES.length());
    +        long[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                LongVector av = LongVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, LongMaxVectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "longCompareOpProvider")
         static void ltLongMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5690,6 +5879,23 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, LongMaxVectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressLongMaxVectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
     
         @DataProvider
         public static Object[][] offsetProvider() {
    @@ -5716,6 +5922,20 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongLongMaxVectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5736,6 +5956,14 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongLongMaxVectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeLongMaxVectorTestsSmokeTest() {
             LongVector av = LongVector.zero(SPECIES);
    @@ -5798,4 +6026,3 @@ public class LongMaxVectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java
    index 570293fccb1..13b59c5ffbc 100644
    --- a/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ShortVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.ShortBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfShort ELEMENT_LAYOUT = ValueLayout.JAVA_SHORT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
     
    @@ -68,17 +70,6 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> SHORT_GENERATORS = List.of(
                 withToString("short[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferProvider() {
    +    public Object[][] shortMemorySegmentProvider() {
             return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferMaskProvider() {
    +    public Object[][] shortMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> SHORT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] shortByteArrayProvider() {
    -        return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] shortByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> SHORT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] shortByteProviderForIOOBE() {
             var f = SHORT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(short[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (short v : a) {
    -            bb.putShort(v);
    +    static MemorySegment toSegment(short[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static short[] bufferToArray(ByteBuffer bb) {
    -        ShortBuffer db = bb.asShortBuffer();
    -        short[] d = new short[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(short[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ShortBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asShortBuffer();
    -        for (short v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static short[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "shortProvider")
         static void loadStoreArray(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "shortByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "shortMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             short[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "shortByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "shortByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Short128VectorTests.java b/test/jdk/jdk/incubator/vector/Short128VectorTests.java
    index 1ca74bc4dc1..5490c9f990c 100644
    --- a/test/jdk/jdk/incubator/vector/Short128VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Short128VectorTests.java
    @@ -261,6 +261,55 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (short)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (short)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(short[] r, short[] a, short[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -884,7 +933,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static short bits(short e) {
             return  e;
         }
    @@ -979,8 +1027,6 @@ public class Short128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1056,7 +1102,6 @@ public class Short128VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> SHORT_COMPARE_GENERATORS = List.of(
                 withToString("short[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1197,6 +1242,22 @@ public class Short128VectorTests extends AbstractVectorTest {
             return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
         }
     
    +    static short TRAILING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a != 0 ? Integer.numberOfTrailingZeros(a) : 16);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 16 : 0);
    +    }
    +
    +    static short REVERSE_scalar(short a) {
    +        short b = ROL_scalar(a, (short) 8);
    +        b = (short) (((b & 0x5555) << 1) | ((b & 0xAAAA) >>> 1));
    +        b = (short) (((b & 0x3333) << 2) | ((b & 0xCCCC) >>> 2));
    +        b = (short) (((b & 0x0F0F) << 4) | ((b & 0xF0F0) >>> 4));
    +        return b;
    +    }
    +
         static boolean eq(short a, short b) {
             return a == b;
         }
    @@ -1346,6 +1407,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static short ADD(short a, short b) {
             return (short)(a + b);
         }
    @@ -1366,6 +1428,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short128VectorTests::ADD);
         }
    +
         static short add(short a, short b) {
             return (short)(a + b);
         }
    @@ -1422,6 +1485,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Short128VectorTests::add);
         }
    +
         static short SUB(short a, short b) {
             return (short)(a - b);
         }
    @@ -1442,6 +1506,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short128VectorTests::SUB);
         }
    +
         static short sub(short a, short b) {
             return (short)(a - b);
         }
    @@ -1498,6 +1563,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Short128VectorTests::sub);
         }
    +
         static short MUL(short a, short b) {
             return (short)(a * b);
         }
    @@ -1518,6 +1584,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short128VectorTests::MUL);
         }
    +
         static short mul(short a, short b) {
             return (short)(a * b);
         }
    @@ -1575,8 +1642,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::mul);
         }
     
    -
    -
         static short DIV(short a, short b) {
             return (short)(a / b);
         }
    @@ -1599,6 +1664,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short128VectorTests::DIV);
         }
    +
         static short div(short a, short b) {
             return (short)(a / b);
         }
    @@ -1622,8 +1688,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void DIVShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1729,6 +1793,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short128VectorTests::AND);
         }
    +
         static short and(short a, short b) {
             return (short)(a & b);
         }
    @@ -1748,8 +1813,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1770,7 +1833,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::AND);
         }
     
    -
         static short AND_NOT(short a, short b) {
             return (short)(a & ~b);
         }
    @@ -1792,8 +1854,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void AND_NOTShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1814,7 +1874,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::AND_NOT);
         }
     
    -
         static short OR(short a, short b) {
             return (short)(a | b);
         }
    @@ -1835,6 +1894,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short128VectorTests::OR);
         }
    +
         static short or(short a, short b) {
             return (short)(a | b);
         }
    @@ -1854,8 +1914,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1876,7 +1934,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::OR);
         }
     
    -
         static short XOR(short a, short b) {
             return (short)(a ^ b);
         }
    @@ -1898,8 +1955,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void XORShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1920,7 +1975,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void addShort128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2014,9 +2068,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short128VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void divShort128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2033,8 +2084,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void divShort128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2054,8 +2103,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short128VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShort128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2084,8 +2131,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short128VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2103,8 +2148,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short128VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ANDShort128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2133,8 +2176,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short128VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShort128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2152,8 +2193,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short128VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShort128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2168,8 +2207,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Short128VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort128VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2187,7 +2224,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Short128VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ADDShort128VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2219,10 +2255,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Short128VectorTests::ADD);
         }
     
    -
    -
    -
    -
         static short LSHL(short a, short b) {
             return (short)((a << (b & 0xF)));
         }
    @@ -2244,8 +2276,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2266,11 +2296,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static short ASHR(short a, short b) {
             return (short)((a >> (b & 0xF)));
         }
    @@ -2292,8 +2317,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2314,11 +2337,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHR(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 0xF)));
         }
    @@ -2340,8 +2358,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2362,11 +2378,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHL_unary(short a, short b) {
             return (short)((a << (b & 15)));
         }
    @@ -2387,8 +2398,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short128VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShort128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2408,11 +2417,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short128VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static short LSHR_unary(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 15)));
         }
    @@ -2433,8 +2437,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short128VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShort128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2454,11 +2456,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short128VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static short ASHR_unary(short a, short b) {
             return (short)((a >> (b & 15)));
         }
    @@ -2479,8 +2476,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short128VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShort128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2500,7 +2495,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short128VectorTests::ASHR_unary);
         }
     
    -
         static short ROR(short a, short b) {
             return (short)(ROR_scalar(a,b));
         }
    @@ -2522,8 +2516,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2544,7 +2536,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::ROR);
         }
     
    -
         static short ROL(short a, short b) {
             return (short)(ROL_scalar(a,b));
         }
    @@ -2566,8 +2557,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short128VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2588,7 +2577,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short128VectorTests::ROL);
         }
     
    -
         static short ROR_unary(short a, short b) {
             return (short)(ROR_scalar(a, b));
         }
    @@ -2609,8 +2597,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short128VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShort128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2630,7 +2616,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short128VectorTests::ROR_unary);
         }
     
    -
         static short ROL_unary(short a, short b) {
             return (short)(ROL_scalar(a, b));
         }
    @@ -2651,8 +2636,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short128VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShort128VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2671,12 +2654,6 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Short128VectorTests::ROL_unary);
         }
    -
    -
    -
    -
    -
    -
         static short LSHR_binary_const(short a) {
             return (short)(((a & 0xFFFF) >>> CONST_SHIFT));
         }
    @@ -2696,8 +2673,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short128VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHRShort128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2716,8 +2691,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short128VectorTests::LSHR_binary_const);
         }
     
    -
    -
         static short LSHL_binary_const(short a) {
             return (short)((a << CONST_SHIFT));
         }
    @@ -2737,8 +2710,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short128VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHLShort128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2757,8 +2728,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short128VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static short ASHR_binary_const(short a) {
             return (short)((a >> CONST_SHIFT));
         }
    @@ -2778,8 +2747,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short128VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ASHRShort128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2798,8 +2765,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short128VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static short ROR_binary_const(short a) {
             return (short)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2819,8 +2784,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short128VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void RORShort128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2839,8 +2802,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short128VectorTests::ROR_binary_const);
         }
     
    -
    -
         static short ROL_binary_const(short a) {
             return (short)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2860,8 +2821,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short128VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ROLShort128VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2901,6 +2860,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short128VectorTests::MIN);
         }
    +
         static short min(short a, short b) {
             return (short)(Math.min(a, b));
         }
    @@ -2919,6 +2879,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short128VectorTests::min);
         }
    +
         static short MAX(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -2939,6 +2900,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short128VectorTests::MAX);
         }
    +
         static short max(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -3032,7 +2994,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ANDReduceShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3058,7 +3019,6 @@ public class Short128VectorTests extends AbstractVectorTest {
                     Short128VectorTests::ANDReduce, Short128VectorTests::ANDReduceAll);
         }
     
    -
         static short ANDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3078,7 +3038,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ANDReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3106,7 +3065,6 @@ public class Short128VectorTests extends AbstractVectorTest {
                     Short128VectorTests::ANDReduceMasked, Short128VectorTests::ANDReduceAllMasked);
         }
     
    -
         static short ORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3125,7 +3083,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ORReduceShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3151,7 +3108,6 @@ public class Short128VectorTests extends AbstractVectorTest {
                     Short128VectorTests::ORReduce, Short128VectorTests::ORReduceAll);
         }
     
    -
         static short ORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3171,7 +3127,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ORReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3199,7 +3154,6 @@ public class Short128VectorTests extends AbstractVectorTest {
                     Short128VectorTests::ORReduceMasked, Short128VectorTests::ORReduceAllMasked);
         }
     
    -
         static short XORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3218,7 +3172,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void XORReduceShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3244,7 +3197,6 @@ public class Short128VectorTests extends AbstractVectorTest {
                     Short128VectorTests::XORReduce, Short128VectorTests::XORReduceAll);
         }
     
    -
         static short XORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3264,7 +3216,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void XORReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3309,6 +3260,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ADDReduceShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3333,6 +3285,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short128VectorTests::ADDReduce, Short128VectorTests::ADDReduceAll);
         }
    +
         static short ADDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3351,6 +3304,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ADDReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3377,6 +3331,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short128VectorTests::ADDReduceMasked, Short128VectorTests::ADDReduceAllMasked);
         }
    +
         static short MULReduce(short[] a, int idx) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3394,6 +3349,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MULReduceShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3418,6 +3374,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short128VectorTests::MULReduce, Short128VectorTests::MULReduceAll);
         }
    +
         static short MULReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3436,6 +3393,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MULReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3462,6 +3420,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short128VectorTests::MULReduceMasked, Short128VectorTests::MULReduceAllMasked);
         }
    +
         static short MINReduce(short[] a, int idx) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3479,6 +3438,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MINReduceShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3503,6 +3463,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short128VectorTests::MINReduce, Short128VectorTests::MINReduceAll);
         }
    +
         static short MINReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3521,6 +3482,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MINReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3547,6 +3509,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short128VectorTests::MINReduceMasked, Short128VectorTests::MINReduceAllMasked);
         }
    +
         static short MAXReduce(short[] a, int idx) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3564,6 +3527,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MAXReduceShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3588,6 +3552,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short128VectorTests::MAXReduce, Short128VectorTests::MAXReduceAll);
         }
    +
         static short MAXReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3606,6 +3571,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MAXReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3632,6 +3598,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short128VectorTests::MAXReduceMasked, Short128VectorTests::MAXReduceAllMasked);
         }
    +
         static short FIRST_NONZEROReduce(short[] a, int idx) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3649,6 +3616,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void FIRST_NONZEROReduceShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3673,6 +3641,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short128VectorTests::FIRST_NONZEROReduce, Short128VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static short FIRST_NONZEROReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3691,6 +3660,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3727,7 +3697,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueShort128VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3743,7 +3712,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Short128VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3753,7 +3721,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueShort128VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3769,7 +3736,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Short128VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void withShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3787,6 +3753,7 @@ public class Short128VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(short a) {
             return bits(a)==0;
         }
    @@ -3827,6 +3794,7 @@ public class Short128VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(short a) {
             return bits(a)<0;
         }
    @@ -3868,9 +3836,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3890,7 +3855,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3933,7 +3897,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GTShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3976,7 +3939,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void EQShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3996,7 +3958,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void eqShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4039,7 +4000,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void NEShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4082,7 +4042,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LEShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4125,7 +4084,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GEShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4168,8 +4126,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LTShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4189,8 +4145,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LTShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4214,9 +4168,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GTShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4236,8 +4187,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GTShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4261,9 +4210,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LEShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4283,8 +4229,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LEShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4308,9 +4252,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GEShort128VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4330,8 +4271,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GEShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4355,8 +4294,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShort128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4373,7 +4310,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShort128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4410,7 +4346,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShort128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4447,7 +4382,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShort128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4484,7 +4418,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShort128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4563,6 +4496,43 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void compressShort128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void expandShort128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void getShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4733,10 +4703,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZeroShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4751,9 +4717,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static short[] sliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4779,6 +4742,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Short128VectorTests::sliceUnary);
         }
    +
         static short[] sliceBinary(short[] a, short[] b, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4808,6 +4772,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Short128VectorTests::sliceBinary);
         }
    +
         static short[] slice(short[] a, short[] b, int origin, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4841,6 +4806,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Short128VectorTests::slice);
         }
    +
         static short[] unsliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4868,6 +4834,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Short128VectorTests::unsliceUnary);
         }
    +
         static short[] unsliceBinary(short[] a, short[] b, int origin, int part, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4907,6 +4874,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Short128VectorTests::unsliceBinary);
         }
    +
         static short[] unslice(short[] a, short[] b, int origin, int part, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4964,36 +4932,14 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Short128VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static short BITWISE_BLEND(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
    +
         static short bitwiseBlend(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5012,6 +4958,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Short128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort128VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5029,7 +4976,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Short128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort128VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5052,9 +4998,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Short128VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5084,6 +5027,7 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Short128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5114,7 +5058,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Short128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort128VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5153,9 +5096,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Short128VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5170,6 +5110,7 @@ public class Short128VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Short128VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort128VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5185,7 +5126,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Short128VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort128VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5204,7 +5144,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Short128VectorTests::BITWISE_BLEND);
         }
     
    -
         static short NEG(short a) {
             return (short)(-((short)a));
         }
    @@ -5317,7 +5256,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short128VectorTests::ABS);
         }
     
    -
         static short NOT(short a) {
             return (short)(~((short)a));
         }
    @@ -5326,8 +5264,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             return (short)(~((short)a));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void NOTShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5358,8 +5294,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Short128VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void NOTMaskedShort128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5378,14 +5312,10 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short128VectorTests::NOT);
         }
     
    -
    -
         static short ZOMO(short a) {
             return (short)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZOMOShort128VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5401,8 +5331,6 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Short128VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ZOMOMaskedShort128VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5421,9 +5349,190 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short128VectorTests::ZOMO);
         }
     
    +    static short BIT_COUNT(short a) {
    +        return (short)(Integer.bitCount((int)a & 0xFFFF));
    +    }
     
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void BIT_COUNTShort128VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Short128VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedShort128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short128VectorTests::BIT_COUNT);
    +    }
    +
    +    static short TRAILING_ZEROS_COUNT(short a) {
    +        return (short)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTShort128VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short128VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedShort128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short128VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT(short a) {
    +        return (short)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTShort128VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short128VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedShort128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short128VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static short REVERSE(short a) {
    +        return (short)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSEShort128VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short128VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSEMaskedShort128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short128VectorTests::REVERSE);
    +    }
    +
    +    static short REVERSE_BYTES(short a) {
    +        return (short)(Short.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSE_BYTESShort128VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short128VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedShort128VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short128VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShort128VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5826,6 +5935,23 @@ public class Short128VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Short128VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressShort128VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5868,6 +5994,20 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongShort128VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5888,6 +6028,14 @@ public class Short128VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongShort128VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeShort128VectorTestsSmokeTest() {
             ShortVector av = ShortVector.zero(SPECIES);
    @@ -5950,4 +6098,3 @@ public class Short128VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java
    index bb2d3130ed3..ad2204cc822 100644
    --- a/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ShortVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.ShortBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfShort ELEMENT_LAYOUT = ValueLayout.JAVA_SHORT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
     
    @@ -68,17 +70,6 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> SHORT_GENERATORS = List.of(
                 withToString("short[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferProvider() {
    +    public Object[][] shortMemorySegmentProvider() {
             return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferMaskProvider() {
    +    public Object[][] shortMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> SHORT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] shortByteArrayProvider() {
    -        return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] shortByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> SHORT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] shortByteProviderForIOOBE() {
             var f = SHORT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(short[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (short v : a) {
    -            bb.putShort(v);
    +    static MemorySegment toSegment(short[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static short[] bufferToArray(ByteBuffer bb) {
    -        ShortBuffer db = bb.asShortBuffer();
    -        short[] d = new short[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(short[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ShortBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asShortBuffer();
    -        for (short v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static short[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "shortProvider")
         static void loadStoreArray(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "shortByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "shortMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             short[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "shortByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "shortByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Short256VectorTests.java b/test/jdk/jdk/incubator/vector/Short256VectorTests.java
    index ef81c76569d..6bc5f9ee59a 100644
    --- a/test/jdk/jdk/incubator/vector/Short256VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Short256VectorTests.java
    @@ -261,6 +261,55 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (short)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (short)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(short[] r, short[] a, short[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -884,7 +933,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static short bits(short e) {
             return  e;
         }
    @@ -979,8 +1027,6 @@ public class Short256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1056,7 +1102,6 @@ public class Short256VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> SHORT_COMPARE_GENERATORS = List.of(
                 withToString("short[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1197,6 +1242,22 @@ public class Short256VectorTests extends AbstractVectorTest {
             return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
         }
     
    +    static short TRAILING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a != 0 ? Integer.numberOfTrailingZeros(a) : 16);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 16 : 0);
    +    }
    +
    +    static short REVERSE_scalar(short a) {
    +        short b = ROL_scalar(a, (short) 8);
    +        b = (short) (((b & 0x5555) << 1) | ((b & 0xAAAA) >>> 1));
    +        b = (short) (((b & 0x3333) << 2) | ((b & 0xCCCC) >>> 2));
    +        b = (short) (((b & 0x0F0F) << 4) | ((b & 0xF0F0) >>> 4));
    +        return b;
    +    }
    +
         static boolean eq(short a, short b) {
             return a == b;
         }
    @@ -1346,6 +1407,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static short ADD(short a, short b) {
             return (short)(a + b);
         }
    @@ -1366,6 +1428,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short256VectorTests::ADD);
         }
    +
         static short add(short a, short b) {
             return (short)(a + b);
         }
    @@ -1422,6 +1485,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Short256VectorTests::add);
         }
    +
         static short SUB(short a, short b) {
             return (short)(a - b);
         }
    @@ -1442,6 +1506,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short256VectorTests::SUB);
         }
    +
         static short sub(short a, short b) {
             return (short)(a - b);
         }
    @@ -1498,6 +1563,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Short256VectorTests::sub);
         }
    +
         static short MUL(short a, short b) {
             return (short)(a * b);
         }
    @@ -1518,6 +1584,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short256VectorTests::MUL);
         }
    +
         static short mul(short a, short b) {
             return (short)(a * b);
         }
    @@ -1575,8 +1642,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::mul);
         }
     
    -
    -
         static short DIV(short a, short b) {
             return (short)(a / b);
         }
    @@ -1599,6 +1664,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short256VectorTests::DIV);
         }
    +
         static short div(short a, short b) {
             return (short)(a / b);
         }
    @@ -1622,8 +1688,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void DIVShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1729,6 +1793,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short256VectorTests::AND);
         }
    +
         static short and(short a, short b) {
             return (short)(a & b);
         }
    @@ -1748,8 +1813,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1770,7 +1833,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::AND);
         }
     
    -
         static short AND_NOT(short a, short b) {
             return (short)(a & ~b);
         }
    @@ -1792,8 +1854,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void AND_NOTShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1814,7 +1874,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::AND_NOT);
         }
     
    -
         static short OR(short a, short b) {
             return (short)(a | b);
         }
    @@ -1835,6 +1894,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short256VectorTests::OR);
         }
    +
         static short or(short a, short b) {
             return (short)(a | b);
         }
    @@ -1854,8 +1914,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1876,7 +1934,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::OR);
         }
     
    -
         static short XOR(short a, short b) {
             return (short)(a ^ b);
         }
    @@ -1898,8 +1955,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void XORShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1920,7 +1975,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void addShort256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2014,9 +2068,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short256VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void divShort256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2033,8 +2084,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void divShort256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2054,8 +2103,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short256VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShort256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2084,8 +2131,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short256VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2103,8 +2148,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short256VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ANDShort256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2133,8 +2176,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short256VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShort256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2152,8 +2193,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short256VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShort256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2168,8 +2207,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Short256VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort256VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2187,7 +2224,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Short256VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ADDShort256VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2219,10 +2255,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Short256VectorTests::ADD);
         }
     
    -
    -
    -
    -
         static short LSHL(short a, short b) {
             return (short)((a << (b & 0xF)));
         }
    @@ -2244,8 +2276,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2266,11 +2296,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static short ASHR(short a, short b) {
             return (short)((a >> (b & 0xF)));
         }
    @@ -2292,8 +2317,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2314,11 +2337,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHR(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 0xF)));
         }
    @@ -2340,8 +2358,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2362,11 +2378,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHL_unary(short a, short b) {
             return (short)((a << (b & 15)));
         }
    @@ -2387,8 +2398,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short256VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShort256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2408,11 +2417,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short256VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static short LSHR_unary(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 15)));
         }
    @@ -2433,8 +2437,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short256VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShort256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2454,11 +2456,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short256VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static short ASHR_unary(short a, short b) {
             return (short)((a >> (b & 15)));
         }
    @@ -2479,8 +2476,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short256VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShort256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2500,7 +2495,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short256VectorTests::ASHR_unary);
         }
     
    -
         static short ROR(short a, short b) {
             return (short)(ROR_scalar(a,b));
         }
    @@ -2522,8 +2516,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2544,7 +2536,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::ROR);
         }
     
    -
         static short ROL(short a, short b) {
             return (short)(ROL_scalar(a,b));
         }
    @@ -2566,8 +2557,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short256VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2588,7 +2577,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short256VectorTests::ROL);
         }
     
    -
         static short ROR_unary(short a, short b) {
             return (short)(ROR_scalar(a, b));
         }
    @@ -2609,8 +2597,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short256VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShort256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2630,7 +2616,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short256VectorTests::ROR_unary);
         }
     
    -
         static short ROL_unary(short a, short b) {
             return (short)(ROL_scalar(a, b));
         }
    @@ -2651,8 +2636,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short256VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShort256VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2671,12 +2654,6 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Short256VectorTests::ROL_unary);
         }
    -
    -
    -
    -
    -
    -
         static short LSHR_binary_const(short a) {
             return (short)(((a & 0xFFFF) >>> CONST_SHIFT));
         }
    @@ -2696,8 +2673,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short256VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHRShort256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2716,8 +2691,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short256VectorTests::LSHR_binary_const);
         }
     
    -
    -
         static short LSHL_binary_const(short a) {
             return (short)((a << CONST_SHIFT));
         }
    @@ -2737,8 +2710,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short256VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHLShort256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2757,8 +2728,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short256VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static short ASHR_binary_const(short a) {
             return (short)((a >> CONST_SHIFT));
         }
    @@ -2778,8 +2747,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short256VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ASHRShort256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2798,8 +2765,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short256VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static short ROR_binary_const(short a) {
             return (short)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2819,8 +2784,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short256VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void RORShort256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2839,8 +2802,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short256VectorTests::ROR_binary_const);
         }
     
    -
    -
         static short ROL_binary_const(short a) {
             return (short)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2860,8 +2821,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short256VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ROLShort256VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2901,6 +2860,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short256VectorTests::MIN);
         }
    +
         static short min(short a, short b) {
             return (short)(Math.min(a, b));
         }
    @@ -2919,6 +2879,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short256VectorTests::min);
         }
    +
         static short MAX(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -2939,6 +2900,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short256VectorTests::MAX);
         }
    +
         static short max(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -3032,7 +2994,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ANDReduceShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3058,7 +3019,6 @@ public class Short256VectorTests extends AbstractVectorTest {
                     Short256VectorTests::ANDReduce, Short256VectorTests::ANDReduceAll);
         }
     
    -
         static short ANDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3078,7 +3038,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ANDReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3106,7 +3065,6 @@ public class Short256VectorTests extends AbstractVectorTest {
                     Short256VectorTests::ANDReduceMasked, Short256VectorTests::ANDReduceAllMasked);
         }
     
    -
         static short ORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3125,7 +3083,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ORReduceShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3151,7 +3108,6 @@ public class Short256VectorTests extends AbstractVectorTest {
                     Short256VectorTests::ORReduce, Short256VectorTests::ORReduceAll);
         }
     
    -
         static short ORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3171,7 +3127,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ORReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3199,7 +3154,6 @@ public class Short256VectorTests extends AbstractVectorTest {
                     Short256VectorTests::ORReduceMasked, Short256VectorTests::ORReduceAllMasked);
         }
     
    -
         static short XORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3218,7 +3172,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void XORReduceShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3244,7 +3197,6 @@ public class Short256VectorTests extends AbstractVectorTest {
                     Short256VectorTests::XORReduce, Short256VectorTests::XORReduceAll);
         }
     
    -
         static short XORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3264,7 +3216,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void XORReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3309,6 +3260,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ADDReduceShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3333,6 +3285,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short256VectorTests::ADDReduce, Short256VectorTests::ADDReduceAll);
         }
    +
         static short ADDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3351,6 +3304,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ADDReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3377,6 +3331,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short256VectorTests::ADDReduceMasked, Short256VectorTests::ADDReduceAllMasked);
         }
    +
         static short MULReduce(short[] a, int idx) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3394,6 +3349,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MULReduceShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3418,6 +3374,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short256VectorTests::MULReduce, Short256VectorTests::MULReduceAll);
         }
    +
         static short MULReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3436,6 +3393,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MULReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3462,6 +3420,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short256VectorTests::MULReduceMasked, Short256VectorTests::MULReduceAllMasked);
         }
    +
         static short MINReduce(short[] a, int idx) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3479,6 +3438,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MINReduceShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3503,6 +3463,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short256VectorTests::MINReduce, Short256VectorTests::MINReduceAll);
         }
    +
         static short MINReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3521,6 +3482,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MINReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3547,6 +3509,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short256VectorTests::MINReduceMasked, Short256VectorTests::MINReduceAllMasked);
         }
    +
         static short MAXReduce(short[] a, int idx) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3564,6 +3527,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MAXReduceShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3588,6 +3552,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short256VectorTests::MAXReduce, Short256VectorTests::MAXReduceAll);
         }
    +
         static short MAXReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3606,6 +3571,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MAXReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3632,6 +3598,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short256VectorTests::MAXReduceMasked, Short256VectorTests::MAXReduceAllMasked);
         }
    +
         static short FIRST_NONZEROReduce(short[] a, int idx) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3649,6 +3616,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void FIRST_NONZEROReduceShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3673,6 +3641,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short256VectorTests::FIRST_NONZEROReduce, Short256VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static short FIRST_NONZEROReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3691,6 +3660,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3727,7 +3697,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueShort256VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3743,7 +3712,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Short256VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3753,7 +3721,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueShort256VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3769,7 +3736,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Short256VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void withShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3787,6 +3753,7 @@ public class Short256VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(short a) {
             return bits(a)==0;
         }
    @@ -3827,6 +3794,7 @@ public class Short256VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(short a) {
             return bits(a)<0;
         }
    @@ -3868,9 +3836,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3890,7 +3855,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3933,7 +3897,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GTShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3976,7 +3939,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void EQShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3996,7 +3958,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void eqShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4039,7 +4000,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void NEShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4082,7 +4042,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LEShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4125,7 +4084,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GEShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4168,8 +4126,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LTShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4189,8 +4145,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LTShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4214,9 +4168,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GTShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4236,8 +4187,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GTShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4261,9 +4210,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LEShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4283,8 +4229,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LEShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4308,9 +4252,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GEShort256VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4330,8 +4271,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GEShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4355,8 +4294,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShort256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4373,7 +4310,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShort256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4410,7 +4346,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShort256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4447,7 +4382,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShort256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4484,7 +4418,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShort256VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4563,6 +4496,43 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void compressShort256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void expandShort256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void getShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4733,10 +4703,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZeroShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4751,9 +4717,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static short[] sliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4779,6 +4742,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Short256VectorTests::sliceUnary);
         }
    +
         static short[] sliceBinary(short[] a, short[] b, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4808,6 +4772,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Short256VectorTests::sliceBinary);
         }
    +
         static short[] slice(short[] a, short[] b, int origin, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4841,6 +4806,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Short256VectorTests::slice);
         }
    +
         static short[] unsliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4868,6 +4834,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Short256VectorTests::unsliceUnary);
         }
    +
         static short[] unsliceBinary(short[] a, short[] b, int origin, int part, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4907,6 +4874,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Short256VectorTests::unsliceBinary);
         }
    +
         static short[] unslice(short[] a, short[] b, int origin, int part, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4964,36 +4932,14 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Short256VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static short BITWISE_BLEND(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
    +
         static short bitwiseBlend(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5012,6 +4958,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Short256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort256VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5029,7 +4976,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Short256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort256VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5052,9 +4998,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Short256VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5084,6 +5027,7 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Short256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5114,7 +5058,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Short256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort256VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5153,9 +5096,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Short256VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5170,6 +5110,7 @@ public class Short256VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Short256VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort256VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5185,7 +5126,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Short256VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort256VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5204,7 +5144,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Short256VectorTests::BITWISE_BLEND);
         }
     
    -
         static short NEG(short a) {
             return (short)(-((short)a));
         }
    @@ -5317,7 +5256,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short256VectorTests::ABS);
         }
     
    -
         static short NOT(short a) {
             return (short)(~((short)a));
         }
    @@ -5326,8 +5264,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             return (short)(~((short)a));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void NOTShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5358,8 +5294,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Short256VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void NOTMaskedShort256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5378,14 +5312,10 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short256VectorTests::NOT);
         }
     
    -
    -
         static short ZOMO(short a) {
             return (short)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZOMOShort256VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5401,8 +5331,6 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Short256VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ZOMOMaskedShort256VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5421,9 +5349,190 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short256VectorTests::ZOMO);
         }
     
    +    static short BIT_COUNT(short a) {
    +        return (short)(Integer.bitCount((int)a & 0xFFFF));
    +    }
     
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void BIT_COUNTShort256VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Short256VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedShort256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short256VectorTests::BIT_COUNT);
    +    }
    +
    +    static short TRAILING_ZEROS_COUNT(short a) {
    +        return (short)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTShort256VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short256VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedShort256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short256VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT(short a) {
    +        return (short)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTShort256VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short256VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedShort256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short256VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static short REVERSE(short a) {
    +        return (short)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSEShort256VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short256VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSEMaskedShort256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short256VectorTests::REVERSE);
    +    }
    +
    +    static short REVERSE_BYTES(short a) {
    +        return (short)(Short.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSE_BYTESShort256VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short256VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedShort256VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short256VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShort256VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5826,6 +5935,23 @@ public class Short256VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Short256VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressShort256VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5868,6 +5994,20 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongShort256VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5888,6 +6028,14 @@ public class Short256VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongShort256VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeShort256VectorTestsSmokeTest() {
             ShortVector av = ShortVector.zero(SPECIES);
    @@ -5950,4 +6098,3 @@ public class Short256VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java
    index 4abaf7b0517..fb04ca5779d 100644
    --- a/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ShortVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.ShortBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfShort ELEMENT_LAYOUT = ValueLayout.JAVA_SHORT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
     
    @@ -68,17 +70,6 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> SHORT_GENERATORS = List.of(
                 withToString("short[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferProvider() {
    +    public Object[][] shortMemorySegmentProvider() {
             return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferMaskProvider() {
    +    public Object[][] shortMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> SHORT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] shortByteArrayProvider() {
    -        return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] shortByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> SHORT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] shortByteProviderForIOOBE() {
             var f = SHORT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(short[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (short v : a) {
    -            bb.putShort(v);
    +    static MemorySegment toSegment(short[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static short[] bufferToArray(ByteBuffer bb) {
    -        ShortBuffer db = bb.asShortBuffer();
    -        short[] d = new short[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(short[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ShortBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asShortBuffer();
    -        for (short v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static short[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "shortProvider")
         static void loadStoreArray(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "shortByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "shortMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             short[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "shortByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "shortByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Short512VectorTests.java b/test/jdk/jdk/incubator/vector/Short512VectorTests.java
    index 00154defa14..b5c038d414b 100644
    --- a/test/jdk/jdk/incubator/vector/Short512VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Short512VectorTests.java
    @@ -261,6 +261,55 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (short)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (short)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(short[] r, short[] a, short[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -884,7 +933,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static short bits(short e) {
             return  e;
         }
    @@ -979,8 +1027,6 @@ public class Short512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1056,7 +1102,6 @@ public class Short512VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> SHORT_COMPARE_GENERATORS = List.of(
                 withToString("short[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1197,6 +1242,22 @@ public class Short512VectorTests extends AbstractVectorTest {
             return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
         }
     
    +    static short TRAILING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a != 0 ? Integer.numberOfTrailingZeros(a) : 16);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 16 : 0);
    +    }
    +
    +    static short REVERSE_scalar(short a) {
    +        short b = ROL_scalar(a, (short) 8);
    +        b = (short) (((b & 0x5555) << 1) | ((b & 0xAAAA) >>> 1));
    +        b = (short) (((b & 0x3333) << 2) | ((b & 0xCCCC) >>> 2));
    +        b = (short) (((b & 0x0F0F) << 4) | ((b & 0xF0F0) >>> 4));
    +        return b;
    +    }
    +
         static boolean eq(short a, short b) {
             return a == b;
         }
    @@ -1346,6 +1407,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static short ADD(short a, short b) {
             return (short)(a + b);
         }
    @@ -1366,6 +1428,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short512VectorTests::ADD);
         }
    +
         static short add(short a, short b) {
             return (short)(a + b);
         }
    @@ -1422,6 +1485,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Short512VectorTests::add);
         }
    +
         static short SUB(short a, short b) {
             return (short)(a - b);
         }
    @@ -1442,6 +1506,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short512VectorTests::SUB);
         }
    +
         static short sub(short a, short b) {
             return (short)(a - b);
         }
    @@ -1498,6 +1563,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Short512VectorTests::sub);
         }
    +
         static short MUL(short a, short b) {
             return (short)(a * b);
         }
    @@ -1518,6 +1584,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short512VectorTests::MUL);
         }
    +
         static short mul(short a, short b) {
             return (short)(a * b);
         }
    @@ -1575,8 +1642,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::mul);
         }
     
    -
    -
         static short DIV(short a, short b) {
             return (short)(a / b);
         }
    @@ -1599,6 +1664,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short512VectorTests::DIV);
         }
    +
         static short div(short a, short b) {
             return (short)(a / b);
         }
    @@ -1622,8 +1688,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void DIVShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1729,6 +1793,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short512VectorTests::AND);
         }
    +
         static short and(short a, short b) {
             return (short)(a & b);
         }
    @@ -1748,8 +1813,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1770,7 +1833,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::AND);
         }
     
    -
         static short AND_NOT(short a, short b) {
             return (short)(a & ~b);
         }
    @@ -1792,8 +1854,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void AND_NOTShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1814,7 +1874,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::AND_NOT);
         }
     
    -
         static short OR(short a, short b) {
             return (short)(a | b);
         }
    @@ -1835,6 +1894,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short512VectorTests::OR);
         }
    +
         static short or(short a, short b) {
             return (short)(a | b);
         }
    @@ -1854,8 +1914,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1876,7 +1934,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::OR);
         }
     
    -
         static short XOR(short a, short b) {
             return (short)(a ^ b);
         }
    @@ -1898,8 +1955,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void XORShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1920,7 +1975,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void addShort512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2014,9 +2068,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short512VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void divShort512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2033,8 +2084,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void divShort512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2054,8 +2103,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short512VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShort512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2084,8 +2131,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short512VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2103,8 +2148,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short512VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ANDShort512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2133,8 +2176,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short512VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShort512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2152,8 +2193,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short512VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShort512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2168,8 +2207,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Short512VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort512VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2187,7 +2224,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Short512VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ADDShort512VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2219,10 +2255,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Short512VectorTests::ADD);
         }
     
    -
    -
    -
    -
         static short LSHL(short a, short b) {
             return (short)((a << (b & 0xF)));
         }
    @@ -2244,8 +2276,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2266,11 +2296,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static short ASHR(short a, short b) {
             return (short)((a >> (b & 0xF)));
         }
    @@ -2292,8 +2317,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2314,11 +2337,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHR(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 0xF)));
         }
    @@ -2340,8 +2358,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2362,11 +2378,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHL_unary(short a, short b) {
             return (short)((a << (b & 15)));
         }
    @@ -2387,8 +2398,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short512VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShort512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2408,11 +2417,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short512VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static short LSHR_unary(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 15)));
         }
    @@ -2433,8 +2437,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short512VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShort512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2454,11 +2456,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short512VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static short ASHR_unary(short a, short b) {
             return (short)((a >> (b & 15)));
         }
    @@ -2479,8 +2476,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short512VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShort512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2500,7 +2495,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short512VectorTests::ASHR_unary);
         }
     
    -
         static short ROR(short a, short b) {
             return (short)(ROR_scalar(a,b));
         }
    @@ -2522,8 +2516,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2544,7 +2536,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::ROR);
         }
     
    -
         static short ROL(short a, short b) {
             return (short)(ROL_scalar(a,b));
         }
    @@ -2566,8 +2557,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short512VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2588,7 +2577,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short512VectorTests::ROL);
         }
     
    -
         static short ROR_unary(short a, short b) {
             return (short)(ROR_scalar(a, b));
         }
    @@ -2609,8 +2597,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short512VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShort512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2630,7 +2616,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short512VectorTests::ROR_unary);
         }
     
    -
         static short ROL_unary(short a, short b) {
             return (short)(ROL_scalar(a, b));
         }
    @@ -2651,8 +2636,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short512VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShort512VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2671,12 +2654,6 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Short512VectorTests::ROL_unary);
         }
    -
    -
    -
    -
    -
    -
         static short LSHR_binary_const(short a) {
             return (short)(((a & 0xFFFF) >>> CONST_SHIFT));
         }
    @@ -2696,8 +2673,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short512VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHRShort512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2716,8 +2691,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short512VectorTests::LSHR_binary_const);
         }
     
    -
    -
         static short LSHL_binary_const(short a) {
             return (short)((a << CONST_SHIFT));
         }
    @@ -2737,8 +2710,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short512VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHLShort512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2757,8 +2728,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short512VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static short ASHR_binary_const(short a) {
             return (short)((a >> CONST_SHIFT));
         }
    @@ -2778,8 +2747,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short512VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ASHRShort512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2798,8 +2765,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short512VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static short ROR_binary_const(short a) {
             return (short)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2819,8 +2784,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short512VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void RORShort512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2839,8 +2802,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short512VectorTests::ROR_binary_const);
         }
     
    -
    -
         static short ROL_binary_const(short a) {
             return (short)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2860,8 +2821,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short512VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ROLShort512VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2901,6 +2860,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short512VectorTests::MIN);
         }
    +
         static short min(short a, short b) {
             return (short)(Math.min(a, b));
         }
    @@ -2919,6 +2879,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short512VectorTests::min);
         }
    +
         static short MAX(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -2939,6 +2900,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short512VectorTests::MAX);
         }
    +
         static short max(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -3032,7 +2994,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ANDReduceShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3058,7 +3019,6 @@ public class Short512VectorTests extends AbstractVectorTest {
                     Short512VectorTests::ANDReduce, Short512VectorTests::ANDReduceAll);
         }
     
    -
         static short ANDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3078,7 +3038,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ANDReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3106,7 +3065,6 @@ public class Short512VectorTests extends AbstractVectorTest {
                     Short512VectorTests::ANDReduceMasked, Short512VectorTests::ANDReduceAllMasked);
         }
     
    -
         static short ORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3125,7 +3083,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ORReduceShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3151,7 +3108,6 @@ public class Short512VectorTests extends AbstractVectorTest {
                     Short512VectorTests::ORReduce, Short512VectorTests::ORReduceAll);
         }
     
    -
         static short ORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3171,7 +3127,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ORReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3199,7 +3154,6 @@ public class Short512VectorTests extends AbstractVectorTest {
                     Short512VectorTests::ORReduceMasked, Short512VectorTests::ORReduceAllMasked);
         }
     
    -
         static short XORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3218,7 +3172,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void XORReduceShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3244,7 +3197,6 @@ public class Short512VectorTests extends AbstractVectorTest {
                     Short512VectorTests::XORReduce, Short512VectorTests::XORReduceAll);
         }
     
    -
         static short XORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3264,7 +3216,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void XORReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3309,6 +3260,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ADDReduceShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3333,6 +3285,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short512VectorTests::ADDReduce, Short512VectorTests::ADDReduceAll);
         }
    +
         static short ADDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3351,6 +3304,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ADDReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3377,6 +3331,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short512VectorTests::ADDReduceMasked, Short512VectorTests::ADDReduceAllMasked);
         }
    +
         static short MULReduce(short[] a, int idx) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3394,6 +3349,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MULReduceShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3418,6 +3374,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short512VectorTests::MULReduce, Short512VectorTests::MULReduceAll);
         }
    +
         static short MULReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3436,6 +3393,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MULReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3462,6 +3420,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short512VectorTests::MULReduceMasked, Short512VectorTests::MULReduceAllMasked);
         }
    +
         static short MINReduce(short[] a, int idx) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3479,6 +3438,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MINReduceShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3503,6 +3463,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short512VectorTests::MINReduce, Short512VectorTests::MINReduceAll);
         }
    +
         static short MINReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3521,6 +3482,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MINReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3547,6 +3509,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short512VectorTests::MINReduceMasked, Short512VectorTests::MINReduceAllMasked);
         }
    +
         static short MAXReduce(short[] a, int idx) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3564,6 +3527,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MAXReduceShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3588,6 +3552,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short512VectorTests::MAXReduce, Short512VectorTests::MAXReduceAll);
         }
    +
         static short MAXReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3606,6 +3571,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MAXReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3632,6 +3598,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short512VectorTests::MAXReduceMasked, Short512VectorTests::MAXReduceAllMasked);
         }
    +
         static short FIRST_NONZEROReduce(short[] a, int idx) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3649,6 +3616,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void FIRST_NONZEROReduceShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3673,6 +3641,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short512VectorTests::FIRST_NONZEROReduce, Short512VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static short FIRST_NONZEROReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3691,6 +3660,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3727,7 +3697,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueShort512VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3743,7 +3712,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Short512VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3753,7 +3721,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueShort512VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3769,7 +3736,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Short512VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void withShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3787,6 +3753,7 @@ public class Short512VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(short a) {
             return bits(a)==0;
         }
    @@ -3827,6 +3794,7 @@ public class Short512VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(short a) {
             return bits(a)<0;
         }
    @@ -3868,9 +3836,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3890,7 +3855,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3933,7 +3897,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GTShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3976,7 +3939,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void EQShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3996,7 +3958,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void eqShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4039,7 +4000,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void NEShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4082,7 +4042,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LEShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4125,7 +4084,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GEShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4168,8 +4126,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LTShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4189,8 +4145,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LTShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4214,9 +4168,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GTShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4236,8 +4187,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GTShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4261,9 +4210,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LEShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4283,8 +4229,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LEShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4308,9 +4252,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GEShort512VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4330,8 +4271,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GEShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4355,8 +4294,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShort512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4373,7 +4310,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShort512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4410,7 +4346,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShort512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4447,7 +4382,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShort512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4484,7 +4418,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShort512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4563,6 +4496,43 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void compressShort512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void expandShort512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void getShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4733,10 +4703,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZeroShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4751,9 +4717,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static short[] sliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4779,6 +4742,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Short512VectorTests::sliceUnary);
         }
    +
         static short[] sliceBinary(short[] a, short[] b, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4808,6 +4772,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Short512VectorTests::sliceBinary);
         }
    +
         static short[] slice(short[] a, short[] b, int origin, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4841,6 +4806,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Short512VectorTests::slice);
         }
    +
         static short[] unsliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4868,6 +4834,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Short512VectorTests::unsliceUnary);
         }
    +
         static short[] unsliceBinary(short[] a, short[] b, int origin, int part, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4907,6 +4874,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Short512VectorTests::unsliceBinary);
         }
    +
         static short[] unslice(short[] a, short[] b, int origin, int part, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4964,36 +4932,14 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Short512VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static short BITWISE_BLEND(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
    +
         static short bitwiseBlend(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5012,6 +4958,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Short512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort512VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5029,7 +4976,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Short512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort512VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5052,9 +4998,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Short512VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5084,6 +5027,7 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Short512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5114,7 +5058,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Short512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort512VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5153,9 +5096,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Short512VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5170,6 +5110,7 @@ public class Short512VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Short512VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort512VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5185,7 +5126,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Short512VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort512VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5204,7 +5144,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Short512VectorTests::BITWISE_BLEND);
         }
     
    -
         static short NEG(short a) {
             return (short)(-((short)a));
         }
    @@ -5317,7 +5256,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short512VectorTests::ABS);
         }
     
    -
         static short NOT(short a) {
             return (short)(~((short)a));
         }
    @@ -5326,8 +5264,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             return (short)(~((short)a));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void NOTShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5358,8 +5294,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Short512VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void NOTMaskedShort512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5378,14 +5312,10 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short512VectorTests::NOT);
         }
     
    -
    -
         static short ZOMO(short a) {
             return (short)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZOMOShort512VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5401,8 +5331,6 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Short512VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ZOMOMaskedShort512VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5421,9 +5349,190 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short512VectorTests::ZOMO);
         }
     
    +    static short BIT_COUNT(short a) {
    +        return (short)(Integer.bitCount((int)a & 0xFFFF));
    +    }
     
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void BIT_COUNTShort512VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Short512VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedShort512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short512VectorTests::BIT_COUNT);
    +    }
    +
    +    static short TRAILING_ZEROS_COUNT(short a) {
    +        return (short)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTShort512VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short512VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedShort512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short512VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT(short a) {
    +        return (short)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTShort512VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short512VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedShort512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short512VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static short REVERSE(short a) {
    +        return (short)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSEShort512VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short512VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSEMaskedShort512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short512VectorTests::REVERSE);
    +    }
    +
    +    static short REVERSE_BYTES(short a) {
    +        return (short)(Short.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSE_BYTESShort512VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short512VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedShort512VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short512VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShort512VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5826,6 +5935,23 @@ public class Short512VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Short512VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressShort512VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5868,6 +5994,20 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongShort512VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5888,6 +6028,14 @@ public class Short512VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongShort512VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeShort512VectorTestsSmokeTest() {
             ShortVector av = ShortVector.zero(SPECIES);
    @@ -5950,4 +6098,3 @@ public class Short512VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java
    index 22717e64b51..157a0638bdb 100644
    --- a/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java
    @@ -31,6 +31,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ShortVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorSpecies;
    @@ -40,10 +43,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.nio.ByteBuffer;
    -import java.nio.ShortBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -54,6 +54,8 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfShort ELEMENT_LAYOUT = ValueLayout.JAVA_SHORT.withBitAlignment(8);
    +
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64);
     
    @@ -68,17 +70,6 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> SHORT_GENERATORS = List.of(
                 withToString("short[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -118,7 +109,7 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -189,9 +180,9 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferProvider() {
    +    public Object[][] shortMemorySegmentProvider() {
             return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -199,35 +190,16 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferMaskProvider() {
    +    public Object[][] shortMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> SHORT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] shortByteArrayProvider() {
    -        return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] shortByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> SHORT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] shortByteProviderForIOOBE() {
             var f = SHORT_GENERATORS.get(0);
    @@ -247,28 +219,16 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(short[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (short v : a) {
    -            bb.putShort(v);
    +    static MemorySegment toSegment(short[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static short[] bufferToArray(ByteBuffer bb) {
    -        ShortBuffer db = bb.asShortBuffer();
    -        short[] d = new short[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(short[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ShortBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asShortBuffer();
    -        for (short v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static short[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -308,46 +268,25 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "shortProvider")
         static void loadStoreArray(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -518,48 +457,45 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -571,25 +507,25 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -600,70 +536,61 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "shortByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "shortMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             short[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -675,27 +602,27 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -706,214 +633,36 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "shortByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "shortByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -928,6 +677,7 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/Short64VectorTests.java b/test/jdk/jdk/incubator/vector/Short64VectorTests.java
    index 2a575173815..68698945a4e 100644
    --- a/test/jdk/jdk/incubator/vector/Short64VectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/Short64VectorTests.java
    @@ -261,6 +261,55 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (short)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (short)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(short[] r, short[] a, short[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -884,7 +933,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static short bits(short e) {
             return  e;
         }
    @@ -979,8 +1027,6 @@ public class Short64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1056,7 +1102,6 @@ public class Short64VectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> SHORT_COMPARE_GENERATORS = List.of(
                 withToString("short[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1197,6 +1242,22 @@ public class Short64VectorTests extends AbstractVectorTest {
             return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
         }
     
    +    static short TRAILING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a != 0 ? Integer.numberOfTrailingZeros(a) : 16);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 16 : 0);
    +    }
    +
    +    static short REVERSE_scalar(short a) {
    +        short b = ROL_scalar(a, (short) 8);
    +        b = (short) (((b & 0x5555) << 1) | ((b & 0xAAAA) >>> 1));
    +        b = (short) (((b & 0x3333) << 2) | ((b & 0xCCCC) >>> 2));
    +        b = (short) (((b & 0x0F0F) << 4) | ((b & 0xF0F0) >>> 4));
    +        return b;
    +    }
    +
         static boolean eq(short a, short b) {
             return a == b;
         }
    @@ -1346,6 +1407,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static short ADD(short a, short b) {
             return (short)(a + b);
         }
    @@ -1366,6 +1428,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short64VectorTests::ADD);
         }
    +
         static short add(short a, short b) {
             return (short)(a + b);
         }
    @@ -1422,6 +1485,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Short64VectorTests::add);
         }
    +
         static short SUB(short a, short b) {
             return (short)(a - b);
         }
    @@ -1442,6 +1506,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short64VectorTests::SUB);
         }
    +
         static short sub(short a, short b) {
             return (short)(a - b);
         }
    @@ -1498,6 +1563,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, Short64VectorTests::sub);
         }
    +
         static short MUL(short a, short b) {
             return (short)(a * b);
         }
    @@ -1518,6 +1584,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short64VectorTests::MUL);
         }
    +
         static short mul(short a, short b) {
             return (short)(a * b);
         }
    @@ -1575,8 +1642,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::mul);
         }
     
    -
    -
         static short DIV(short a, short b) {
             return (short)(a / b);
         }
    @@ -1599,6 +1664,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short64VectorTests::DIV);
         }
    +
         static short div(short a, short b) {
             return (short)(a / b);
         }
    @@ -1622,8 +1688,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void DIVShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1729,6 +1793,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short64VectorTests::AND);
         }
    +
         static short and(short a, short b) {
             return (short)(a & b);
         }
    @@ -1748,8 +1813,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1770,7 +1833,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::AND);
         }
     
    -
         static short AND_NOT(short a, short b) {
             return (short)(a & ~b);
         }
    @@ -1792,8 +1854,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void AND_NOTShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1814,7 +1874,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::AND_NOT);
         }
     
    -
         static short OR(short a, short b) {
             return (short)(a | b);
         }
    @@ -1835,6 +1894,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short64VectorTests::OR);
         }
    +
         static short or(short a, short b) {
             return (short)(a | b);
         }
    @@ -1854,8 +1914,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1876,7 +1934,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::OR);
         }
     
    -
         static short XOR(short a, short b) {
             return (short)(a ^ b);
         }
    @@ -1898,8 +1955,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void XORShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1920,7 +1975,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void addShort64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2014,9 +2068,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short64VectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void divShort64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2033,8 +2084,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void divShort64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2054,8 +2103,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short64VectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShort64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2084,8 +2131,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short64VectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2103,8 +2148,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short64VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ANDShort64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2133,8 +2176,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, Short64VectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShort64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2152,8 +2193,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, Short64VectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShort64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2168,8 +2207,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, Short64VectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShort64VectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2187,7 +2224,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Short64VectorTests::OR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ADDShort64VectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2219,10 +2255,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, Short64VectorTests::ADD);
         }
     
    -
    -
    -
    -
         static short LSHL(short a, short b) {
             return (short)((a << (b & 0xF)));
         }
    @@ -2244,8 +2276,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2266,11 +2296,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static short ASHR(short a, short b) {
             return (short)((a >> (b & 0xF)));
         }
    @@ -2292,8 +2317,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2314,11 +2337,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHR(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 0xF)));
         }
    @@ -2340,8 +2358,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2362,11 +2378,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHL_unary(short a, short b) {
             return (short)((a << (b & 15)));
         }
    @@ -2387,8 +2398,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short64VectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShort64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2408,11 +2417,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short64VectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static short LSHR_unary(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 15)));
         }
    @@ -2433,8 +2437,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short64VectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShort64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2454,11 +2456,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short64VectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static short ASHR_unary(short a, short b) {
             return (short)((a >> (b & 15)));
         }
    @@ -2479,8 +2476,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short64VectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShort64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2500,7 +2495,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short64VectorTests::ASHR_unary);
         }
     
    -
         static short ROR(short a, short b) {
             return (short)(ROR_scalar(a,b));
         }
    @@ -2522,8 +2516,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2544,7 +2536,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::ROR);
         }
     
    -
         static short ROL(short a, short b) {
             return (short)(ROL_scalar(a,b));
         }
    @@ -2566,8 +2557,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, Short64VectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2588,7 +2577,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, Short64VectorTests::ROL);
         }
     
    -
         static short ROR_unary(short a, short b) {
             return (short)(ROR_scalar(a, b));
         }
    @@ -2609,8 +2597,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short64VectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShort64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2630,7 +2616,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, Short64VectorTests::ROR_unary);
         }
     
    -
         static short ROL_unary(short a, short b) {
             return (short)(ROL_scalar(a, b));
         }
    @@ -2651,8 +2636,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, Short64VectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShort64VectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2671,12 +2654,6 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, Short64VectorTests::ROL_unary);
         }
    -
    -
    -
    -
    -
    -
         static short LSHR_binary_const(short a) {
             return (short)(((a & 0xFFFF) >>> CONST_SHIFT));
         }
    @@ -2696,8 +2673,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short64VectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHRShort64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2716,8 +2691,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short64VectorTests::LSHR_binary_const);
         }
     
    -
    -
         static short LSHL_binary_const(short a) {
             return (short)((a << CONST_SHIFT));
         }
    @@ -2737,8 +2710,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short64VectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHLShort64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2757,8 +2728,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short64VectorTests::LSHL_binary_const);
         }
     
    -
    -
         static short ASHR_binary_const(short a) {
             return (short)((a >> CONST_SHIFT));
         }
    @@ -2778,8 +2747,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short64VectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ASHRShort64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2798,8 +2765,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short64VectorTests::ASHR_binary_const);
         }
     
    -
    -
         static short ROR_binary_const(short a) {
             return (short)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2819,8 +2784,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short64VectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void RORShort64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2839,8 +2802,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, Short64VectorTests::ROR_binary_const);
         }
     
    -
    -
         static short ROL_binary_const(short a) {
             return (short)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2860,8 +2821,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, Short64VectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ROLShort64VectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2901,6 +2860,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short64VectorTests::MIN);
         }
    +
         static short min(short a, short b) {
             return (short)(Math.min(a, b));
         }
    @@ -2919,6 +2879,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short64VectorTests::min);
         }
    +
         static short MAX(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -2939,6 +2900,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, Short64VectorTests::MAX);
         }
    +
         static short max(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -3032,7 +2994,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ANDReduceShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3058,7 +3019,6 @@ public class Short64VectorTests extends AbstractVectorTest {
                     Short64VectorTests::ANDReduce, Short64VectorTests::ANDReduceAll);
         }
     
    -
         static short ANDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3078,7 +3038,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ANDReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3106,7 +3065,6 @@ public class Short64VectorTests extends AbstractVectorTest {
                     Short64VectorTests::ANDReduceMasked, Short64VectorTests::ANDReduceAllMasked);
         }
     
    -
         static short ORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3125,7 +3083,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ORReduceShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3151,7 +3108,6 @@ public class Short64VectorTests extends AbstractVectorTest {
                     Short64VectorTests::ORReduce, Short64VectorTests::ORReduceAll);
         }
     
    -
         static short ORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3171,7 +3127,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ORReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3199,7 +3154,6 @@ public class Short64VectorTests extends AbstractVectorTest {
                     Short64VectorTests::ORReduceMasked, Short64VectorTests::ORReduceAllMasked);
         }
     
    -
         static short XORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3218,7 +3172,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void XORReduceShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3244,7 +3197,6 @@ public class Short64VectorTests extends AbstractVectorTest {
                     Short64VectorTests::XORReduce, Short64VectorTests::XORReduceAll);
         }
     
    -
         static short XORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3264,7 +3216,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void XORReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3309,6 +3260,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ADDReduceShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3333,6 +3285,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short64VectorTests::ADDReduce, Short64VectorTests::ADDReduceAll);
         }
    +
         static short ADDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3351,6 +3304,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ADDReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3377,6 +3331,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short64VectorTests::ADDReduceMasked, Short64VectorTests::ADDReduceAllMasked);
         }
    +
         static short MULReduce(short[] a, int idx) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3394,6 +3349,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MULReduceShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3418,6 +3374,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short64VectorTests::MULReduce, Short64VectorTests::MULReduceAll);
         }
    +
         static short MULReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3436,6 +3393,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MULReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3462,6 +3420,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short64VectorTests::MULReduceMasked, Short64VectorTests::MULReduceAllMasked);
         }
    +
         static short MINReduce(short[] a, int idx) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3479,6 +3438,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MINReduceShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3503,6 +3463,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short64VectorTests::MINReduce, Short64VectorTests::MINReduceAll);
         }
    +
         static short MINReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3521,6 +3482,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MINReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3547,6 +3509,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short64VectorTests::MINReduceMasked, Short64VectorTests::MINReduceAllMasked);
         }
    +
         static short MAXReduce(short[] a, int idx) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3564,6 +3527,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MAXReduceShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3588,6 +3552,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short64VectorTests::MAXReduce, Short64VectorTests::MAXReduceAll);
         }
    +
         static short MAXReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3606,6 +3571,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MAXReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3632,6 +3598,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     Short64VectorTests::MAXReduceMasked, Short64VectorTests::MAXReduceAllMasked);
         }
    +
         static short FIRST_NONZEROReduce(short[] a, int idx) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3649,6 +3616,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void FIRST_NONZEROReduceShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3673,6 +3641,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     Short64VectorTests::FIRST_NONZEROReduce, Short64VectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static short FIRST_NONZEROReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3691,6 +3660,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3727,7 +3697,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueShort64VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3743,7 +3712,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Short64VectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3753,7 +3721,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueShort64VectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3769,7 +3736,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, Short64VectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void withShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3787,6 +3753,7 @@ public class Short64VectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(short a) {
             return bits(a)==0;
         }
    @@ -3827,6 +3794,7 @@ public class Short64VectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(short a) {
             return bits(a)<0;
         }
    @@ -3868,9 +3836,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3890,7 +3855,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3933,7 +3897,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GTShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3976,7 +3939,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void EQShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3996,7 +3958,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void eqShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4039,7 +4000,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void NEShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4082,7 +4042,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LEShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4125,7 +4084,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GEShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4168,8 +4126,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LTShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4189,8 +4145,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LTShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4214,9 +4168,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GTShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4236,8 +4187,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GTShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4261,9 +4210,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LEShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4283,8 +4229,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LEShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4308,9 +4252,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GEShort64VectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4330,8 +4271,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GEShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4355,8 +4294,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShort64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4373,7 +4310,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShort64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4410,7 +4346,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShort64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4447,7 +4382,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShort64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4484,7 +4418,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShort64VectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4563,6 +4496,43 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void compressShort64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void expandShort64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void getShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4733,10 +4703,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZeroShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4751,9 +4717,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static short[] sliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4779,6 +4742,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Short64VectorTests::sliceUnary);
         }
    +
         static short[] sliceBinary(short[] a, short[] b, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4808,6 +4772,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, Short64VectorTests::sliceBinary);
         }
    +
         static short[] slice(short[] a, short[] b, int origin, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4841,6 +4806,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, Short64VectorTests::slice);
         }
    +
         static short[] unsliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4868,6 +4834,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, Short64VectorTests::unsliceUnary);
         }
    +
         static short[] unsliceBinary(short[] a, short[] b, int origin, int part, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4907,6 +4874,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, Short64VectorTests::unsliceBinary);
         }
    +
         static short[] unslice(short[] a, short[] b, int origin, int part, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4964,36 +4932,14 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, Short64VectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static short BITWISE_BLEND(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
    +
         static short bitwiseBlend(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5012,6 +4958,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, Short64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort64VectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5029,7 +4976,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, Short64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort64VectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5052,9 +4998,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, Short64VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5084,6 +5027,7 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, Short64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5114,7 +5058,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, Short64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort64VectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5153,9 +5096,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, Short64VectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShort64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5170,6 +5110,7 @@ public class Short64VectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, Short64VectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShort64VectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5185,7 +5126,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, Short64VectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShort64VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5204,7 +5144,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Short64VectorTests::BITWISE_BLEND);
         }
     
    -
         static short NEG(short a) {
             return (short)(-((short)a));
         }
    @@ -5317,7 +5256,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short64VectorTests::ABS);
         }
     
    -
         static short NOT(short a) {
             return (short)(~((short)a));
         }
    @@ -5326,8 +5264,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             return (short)(~((short)a));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void NOTShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5358,8 +5294,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Short64VectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void NOTMaskedShort64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5378,14 +5312,10 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short64VectorTests::NOT);
         }
     
    -
    -
         static short ZOMO(short a) {
             return (short)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZOMOShort64VectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5401,8 +5331,6 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, Short64VectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ZOMOMaskedShort64VectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5421,9 +5349,190 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, Short64VectorTests::ZOMO);
         }
     
    +    static short BIT_COUNT(short a) {
    +        return (short)(Integer.bitCount((int)a & 0xFFFF));
    +    }
     
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void BIT_COUNTShort64VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, Short64VectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedShort64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short64VectorTests::BIT_COUNT);
    +    }
    +
    +    static short TRAILING_ZEROS_COUNT(short a) {
    +        return (short)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTShort64VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short64VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedShort64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short64VectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT(short a) {
    +        return (short)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTShort64VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short64VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedShort64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short64VectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static short REVERSE(short a) {
    +        return (short)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSEShort64VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short64VectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSEMaskedShort64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short64VectorTests::REVERSE);
    +    }
    +
    +    static short REVERSE_BYTES(short a) {
    +        return (short)(Short.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSE_BYTESShort64VectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, Short64VectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedShort64VectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, Short64VectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShort64VectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5826,6 +5935,23 @@ public class Short64VectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, Short64VectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressShort64VectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] longMaskProvider() {
             return new Object[][]{
    @@ -5868,6 +5994,20 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongShort64VectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5888,6 +6028,14 @@ public class Short64VectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongShort64VectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeShort64VectorTestsSmokeTest() {
             ShortVector av = ShortVector.zero(SPECIES);
    @@ -5950,4 +6098,3 @@ public class Short64VectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java
    index 0e6a998d386..1129f5cd83a 100644
    --- a/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java
    +++ b/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java
    @@ -32,6 +32,9 @@
     
     // -- This file was mechanically generated: Do not edit! -- //
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.ShortVector;
     import jdk.incubator.vector.VectorMask;
     import jdk.incubator.vector.VectorShape;
    @@ -42,12 +45,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -import java.lang.invoke.MethodHandles;
    -import java.lang.invoke.VarHandle;
    -import java.nio.ByteBuffer;
    -import java.nio.ShortBuffer;
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -58,6 +56,8 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.OfShort ELEMENT_LAYOUT = ValueLayout.JAVA_SHORT.withBitAlignment(8);
    +
         static VectorShape getMaxBit() {
             return VectorShape.S_Max_BIT;
         }
    @@ -77,17 +77,6 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -
         static final List> SHORT_GENERATORS = List.of(
                 withToString("short[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -127,7 +116,7 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -198,9 +187,9 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferProvider() {
    +    public Object[][] shortMemorySegmentProvider() {
             return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -208,35 +197,16 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] shortByteBufferMaskProvider() {
    +    public Object[][] shortMemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> SHORT_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] shortByteArrayProvider() {
    -        return SHORT_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] shortByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> SHORT_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] shortByteProviderForIOOBE() {
             var f = SHORT_GENERATORS.get(0);
    @@ -256,28 +226,16 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer(short[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for (short v : a) {
    -            bb.putShort(v);
    +    static MemorySegment toSegment(short[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static short[] bufferToArray(ByteBuffer bb) {
    -        ShortBuffer db = bb.asShortBuffer();
    -        short[] d = new short[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray(short[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        ShortBuffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).asShortBuffer();
    -        for (short v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static short[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -317,46 +275,25 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static ShortVector fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteArray(SPECIES, a, i, bo, m);
    +    static ShortVector fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        return ShortVector.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray(ShortVector v, byte[] a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment(ShortVector v, MemorySegment a, int i, ByteOrder bo, VectorMask m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static ShortVector fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        return ShortVector.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer(ShortVector v, ByteBuffer a, int i, ByteOrder bo, VectorMask m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "shortProvider")
         static void loadStoreArray(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -527,48 +464,45 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -580,25 +514,25 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -609,70 +543,61 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "shortByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "shortMemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             short[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                ShortVector av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -684,27 +609,27 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, Short.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), Short.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            ShortVector av = ShortVector.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            ShortVector av = ShortVector.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -715,214 +640,36 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "shortMemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "shortByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "shortByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "shortByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "shortByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                ShortVector av = ShortVector.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            ShortVector av = ShortVector.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -937,6 +684,7 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java
    index 999e6240290..6531c67a40b 100644
    --- a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java
    +++ b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java
    @@ -266,6 +266,55 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], (short)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals(short[] r, short[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], (short)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], (short)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals(short[] r, short[] a, short[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -889,7 +938,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         static short bits(short e) {
             return  e;
         }
    @@ -984,8 +1032,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
    -
         @DataProvider
         public Object[][] maskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
    @@ -1061,7 +1107,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
                     toArray(Object[][]::new);
         }
     
    -
         static final List> SHORT_COMPARE_GENERATORS = List.of(
                 withToString("short[i]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -1202,6 +1247,22 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))));
         }
     
    +    static short TRAILING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a != 0 ? Integer.numberOfTrailingZeros(a) : 16);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT_scalar(short a) {
    +        return (short) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 16 : 0);
    +    }
    +
    +    static short REVERSE_scalar(short a) {
    +        short b = ROL_scalar(a, (short) 8);
    +        b = (short) (((b & 0x5555) << 1) | ((b & 0xAAAA) >>> 1));
    +        b = (short) (((b & 0x3333) << 2) | ((b & 0xCCCC) >>> 2));
    +        b = (short) (((b & 0x0F0F) << 4) | ((b & 0xF0F0) >>> 4));
    +        return b;
    +    }
    +
         static boolean eq(short a, short b) {
             return a == b;
         }
    @@ -1351,6 +1412,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             } catch (ArithmeticException e) {
             }
         }
    +
         static short ADD(short a, short b) {
             return (short)(a + b);
         }
    @@ -1371,6 +1433,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ShortMaxVectorTests::ADD);
         }
    +
         static short add(short a, short b) {
             return (short)(a + b);
         }
    @@ -1427,6 +1490,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::add);
         }
    +
         static short SUB(short a, short b) {
             return (short)(a - b);
         }
    @@ -1447,6 +1511,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ShortMaxVectorTests::SUB);
         }
    +
         static short sub(short a, short b) {
             return (short)(a - b);
         }
    @@ -1503,6 +1568,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::sub);
         }
    +
         static short MUL(short a, short b) {
             return (short)(a * b);
         }
    @@ -1523,6 +1589,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ShortMaxVectorTests::MUL);
         }
    +
         static short mul(short a, short b) {
             return (short)(a * b);
         }
    @@ -1580,8 +1647,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::mul);
         }
     
    -
    -
         static short DIV(short a, short b) {
             return (short)(a / b);
         }
    @@ -1604,6 +1669,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ShortMaxVectorTests::DIV);
         }
    +
         static short div(short a, short b) {
             return (short)(a / b);
         }
    @@ -1627,8 +1693,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void DIVShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1734,6 +1798,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ShortMaxVectorTests::AND);
         }
    +
         static short and(short a, short b) {
             return (short)(a & b);
         }
    @@ -1753,8 +1818,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1775,7 +1838,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::AND);
         }
     
    -
         static short AND_NOT(short a, short b) {
             return (short)(a & ~b);
         }
    @@ -1797,8 +1859,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::AND_NOT);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void AND_NOTShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1819,7 +1879,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::AND_NOT);
         }
     
    -
         static short OR(short a, short b) {
             return (short)(a | b);
         }
    @@ -1840,6 +1899,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ShortMaxVectorTests::OR);
         }
    +
         static short or(short a, short b) {
             return (short)(a | b);
         }
    @@ -1859,8 +1919,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1881,7 +1939,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::OR);
         }
     
    -
         static short XOR(short a, short b) {
             return (short)(a ^ b);
         }
    @@ -1903,8 +1960,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::XOR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void XORShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -1925,7 +1980,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::XOR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void addShortMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2019,9 +2073,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, ShortMaxVectorTests::mul);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void divShortMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2038,8 +2089,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, ShortMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void divShortMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2059,8 +2108,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, ShortMaxVectorTests::div);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShortMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2089,8 +2136,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, ShortMaxVectorTests::or);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShortMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2108,8 +2153,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, ShortMaxVectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ANDShortMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2138,8 +2181,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, ShortMaxVectorTests::and);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ANDShortMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2157,8 +2198,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a, b, mask, ShortMaxVectorTests::AND);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ORShortMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2173,8 +2212,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, ShortMaxVectorTests::OR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ORShortMaxVectorTestsBroadcastMaskedLongSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2192,7 +2229,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, ShortMaxVectorTests::OR);
         }
     
    -
         @Test(dataProvider = "shortBinaryOpProvider")
         static void ADDShortMaxVectorTestsBroadcastLongSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -2224,10 +2260,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastLongArraysEquals(r, a, b, mask, ShortMaxVectorTests::ADD);
         }
     
    -
    -
    -
    -
         static short LSHL(short a, short b) {
             return (short)((a << (b & 0xF)));
         }
    @@ -2249,8 +2281,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::LSHL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2271,11 +2301,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::LSHL);
         }
     
    -
    -
    -
    -
    -
         static short ASHR(short a, short b) {
             return (short)((a >> (b & 0xF)));
         }
    @@ -2297,8 +2322,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::ASHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2319,11 +2342,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::ASHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHR(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 0xF)));
         }
    @@ -2345,8 +2363,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::LSHR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2367,11 +2383,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::LSHR);
         }
     
    -
    -
    -
    -
    -
         static short LSHL_unary(short a, short b) {
             return (short)((a << (b & 15)));
         }
    @@ -2392,8 +2403,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ShortMaxVectorTests::LSHL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHLShortMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2413,11 +2422,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, ShortMaxVectorTests::LSHL_unary);
         }
     
    -
    -
    -
    -
    -
         static short LSHR_unary(short a, short b) {
             return (short)(((a & 0xFFFF) >>> (b & 15)));
         }
    @@ -2438,8 +2442,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ShortMaxVectorTests::LSHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void LSHRShortMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2459,11 +2461,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, ShortMaxVectorTests::LSHR_unary);
         }
     
    -
    -
    -
    -
    -
         static short ASHR_unary(short a, short b) {
             return (short)((a >> (b & 15)));
         }
    @@ -2484,8 +2481,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ShortMaxVectorTests::ASHR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ASHRShortMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2505,7 +2500,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, ShortMaxVectorTests::ASHR_unary);
         }
     
    -
         static short ROR(short a, short b) {
             return (short)(ROR_scalar(a,b));
         }
    @@ -2527,8 +2521,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::ROR);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2549,7 +2541,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::ROR);
         }
     
    -
         static short ROL(short a, short b) {
             return (short)(ROL_scalar(a,b));
         }
    @@ -2571,8 +2562,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, ShortMaxVectorTests::ROL);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2593,7 +2582,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, mask, ShortMaxVectorTests::ROL);
         }
     
    -
         static short ROR_unary(short a, short b) {
             return (short)(ROR_scalar(a, b));
         }
    @@ -2614,8 +2602,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ShortMaxVectorTests::ROR_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void RORShortMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2635,7 +2621,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, mask, ShortMaxVectorTests::ROR_unary);
         }
     
    -
         static short ROL_unary(short a, short b) {
             return (short)(ROL_scalar(a, b));
         }
    @@ -2656,8 +2641,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftArraysEquals(r, a, b, ShortMaxVectorTests::ROL_unary);
         }
     
    -
    -
         @Test(dataProvider = "shortBinaryOpMaskProvider")
         static void ROLShortMaxVectorTestsScalarShiftMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fm) {
    @@ -2676,12 +2659,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertShiftArraysEquals(r, a, b, mask, ShortMaxVectorTests::ROL_unary);
         }
    -
    -
    -
    -
    -
    -
         static short LSHR_binary_const(short a) {
             return (short)(((a & 0xFFFF) >>> CONST_SHIFT));
         }
    @@ -2701,8 +2678,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ShortMaxVectorTests::LSHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHRShortMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2721,8 +2696,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, ShortMaxVectorTests::LSHR_binary_const);
         }
     
    -
    -
         static short LSHL_binary_const(short a) {
             return (short)((a << CONST_SHIFT));
         }
    @@ -2742,8 +2715,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ShortMaxVectorTests::LSHL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void LSHLShortMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2762,8 +2733,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, ShortMaxVectorTests::LSHL_binary_const);
         }
     
    -
    -
         static short ASHR_binary_const(short a) {
             return (short)((a >> CONST_SHIFT));
         }
    @@ -2783,8 +2752,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ShortMaxVectorTests::ASHR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ASHRShortMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2803,8 +2770,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, ShortMaxVectorTests::ASHR_binary_const);
         }
     
    -
    -
         static short ROR_binary_const(short a) {
             return (short)(ROR_scalar(a, CONST_SHIFT));
         }
    @@ -2824,8 +2789,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ShortMaxVectorTests::ROR_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void RORShortMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2844,8 +2807,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, mask, ShortMaxVectorTests::ROR_binary_const);
         }
     
    -
    -
         static short ROL_binary_const(short a) {
             return (short)(ROL_scalar(a, CONST_SHIFT));
         }
    @@ -2865,8 +2826,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertShiftConstEquals(r, a, ShortMaxVectorTests::ROL_binary_const);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ROLShortMaxVectorTestsScalarShiftMaskedConst(IntFunction fa,
                                               IntFunction fm) {
    @@ -2906,6 +2865,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ShortMaxVectorTests::MIN);
         }
    +
         static short min(short a, short b) {
             return (short)(Math.min(a, b));
         }
    @@ -2924,6 +2884,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ShortMaxVectorTests::min);
         }
    +
         static short MAX(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -2944,6 +2905,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, ShortMaxVectorTests::MAX);
         }
    +
         static short max(short a, short b) {
             return (short)(Math.max(a, b));
         }
    @@ -3037,7 +2999,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ANDReduceShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3063,7 +3024,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
                     ShortMaxVectorTests::ANDReduce, ShortMaxVectorTests::ANDReduceAll);
         }
     
    -
         static short ANDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = -1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3083,7 +3043,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ANDReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3111,7 +3070,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
                     ShortMaxVectorTests::ANDReduceMasked, ShortMaxVectorTests::ANDReduceAllMasked);
         }
     
    -
         static short ORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3130,7 +3088,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ORReduceShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3156,7 +3113,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
                     ShortMaxVectorTests::ORReduce, ShortMaxVectorTests::ORReduceAll);
         }
     
    -
         static short ORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3176,7 +3132,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ORReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3204,7 +3159,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
                     ShortMaxVectorTests::ORReduceMasked, ShortMaxVectorTests::ORReduceAllMasked);
         }
     
    -
         static short XORReduce(short[] a, int idx) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3223,7 +3177,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void XORReduceShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3249,7 +3202,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
                     ShortMaxVectorTests::XORReduce, ShortMaxVectorTests::XORReduceAll);
         }
     
    -
         static short XORReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3269,7 +3221,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void XORReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3314,6 +3265,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ADDReduceShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3338,6 +3290,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ShortMaxVectorTests::ADDReduce, ShortMaxVectorTests::ADDReduceAll);
         }
    +
         static short ADDReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3356,6 +3309,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ADDReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3382,6 +3336,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     ShortMaxVectorTests::ADDReduceMasked, ShortMaxVectorTests::ADDReduceAllMasked);
         }
    +
         static short MULReduce(short[] a, int idx) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3399,6 +3354,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MULReduceShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3423,6 +3379,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ShortMaxVectorTests::MULReduce, ShortMaxVectorTests::MULReduceAll);
         }
    +
         static short MULReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = 1;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3441,6 +3398,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MULReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3467,6 +3425,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     ShortMaxVectorTests::MULReduceMasked, ShortMaxVectorTests::MULReduceAllMasked);
         }
    +
         static short MINReduce(short[] a, int idx) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3484,6 +3443,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MINReduceShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3508,6 +3468,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ShortMaxVectorTests::MINReduce, ShortMaxVectorTests::MINReduceAll);
         }
    +
         static short MINReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MAX_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3526,6 +3487,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MINReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3552,6 +3514,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     ShortMaxVectorTests::MINReduceMasked, ShortMaxVectorTests::MINReduceAllMasked);
         }
    +
         static short MAXReduce(short[] a, int idx) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3569,6 +3532,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void MAXReduceShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3593,6 +3557,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ShortMaxVectorTests::MAXReduce, ShortMaxVectorTests::MAXReduceAll);
         }
    +
         static short MAXReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = Short.MIN_VALUE;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3611,6 +3576,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void MAXReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3637,6 +3603,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEqualsMasked(r, ra, a, mask,
                     ShortMaxVectorTests::MAXReduceMasked, ShortMaxVectorTests::MAXReduceAllMasked);
         }
    +
         static short FIRST_NONZEROReduce(short[] a, int idx) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3654,6 +3621,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void FIRST_NONZEROReduceShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3678,6 +3646,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionArraysEquals(r, ra, a,
                     ShortMaxVectorTests::FIRST_NONZEROReduce, ShortMaxVectorTests::FIRST_NONZEROReduceAll);
         }
    +
         static short FIRST_NONZEROReduceMasked(short[] a, int idx, boolean[] mask) {
             short res = (short) 0;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3696,6 +3665,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             return res;
         }
    +
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void FIRST_NONZEROReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3732,7 +3702,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void anyTrueShortMaxVectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3748,7 +3717,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, ShortMaxVectorTests::anyTrue);
         }
     
    -
         static boolean allTrue(boolean[] a, int idx) {
             boolean res = true;
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    @@ -3758,7 +3726,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return res;
         }
     
    -
         @Test(dataProvider = "boolUnaryOpProvider")
         static void allTrueShortMaxVectorTests(IntFunction fm) {
             boolean[] mask = fm.apply(SPECIES.length());
    @@ -3774,7 +3741,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertReductionBoolArraysEquals(r, mask, ShortMaxVectorTests::allTrue);
         }
     
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void withShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3792,6 +3758,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
                 assertInsertArraysEquals(r, a, (short)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
             }
         }
    +
         static boolean testIS_DEFAULT(short a) {
             return bits(a)==0;
         }
    @@ -3832,6 +3799,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
                 }
             }
         }
    +
         static boolean testIS_NEGATIVE(short a) {
             return bits(a)<0;
         }
    @@ -3873,9 +3841,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3895,7 +3860,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3938,7 +3902,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GTShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -3981,7 +3944,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void EQShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4001,7 +3963,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void eqShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4044,7 +4005,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void NEShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4087,7 +4047,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LEShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4130,7 +4089,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void GEShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4173,8 +4131,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LTShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4194,8 +4150,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LTShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4219,9 +4173,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GTShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4241,8 +4192,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GTShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4266,9 +4215,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_LEShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4288,8 +4234,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_LEShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4313,9 +4257,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void UNSIGNED_GEShortMaxVectorTests(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4335,8 +4276,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void UNSIGNED_GEShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                                     IntFunction fm) {
    @@ -4360,8 +4299,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
    -
         @Test(dataProvider = "shortCompareOpProvider")
         static void LTShortMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4378,7 +4315,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShortMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4415,7 +4351,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void LTShortMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4452,7 +4387,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShortMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4489,7 +4423,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    -
         @Test(dataProvider = "shortCompareOpMaskProvider")
         static void EQShortMaxVectorTestsBroadcastLongMaskedSmokeTest(IntFunction fa,
                                     IntFunction fb, IntFunction fm) {
    @@ -4568,6 +4501,43 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
         }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void compressShortMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void expandShortMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
         @Test(dataProvider = "shortUnaryOpProvider")
         static void getShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4738,10 +4708,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertBroadcastArraysEquals(r, a);
         }
     
    -
    -
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZeroShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -4756,9 +4722,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(a, r);
         }
     
    -
    -
    -
         static short[] sliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    @@ -4784,6 +4747,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, ShortMaxVectorTests::sliceUnary);
         }
    +
         static short[] sliceBinary(short[] a, short[] b, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4813,6 +4777,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, ShortMaxVectorTests::sliceBinary);
         }
    +
         static short[] slice(short[] a, short[] b, int origin, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4846,6 +4811,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, mask, ShortMaxVectorTests::slice);
         }
    +
         static short[] unsliceUnary(short[] a, int origin, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4873,6 +4839,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, origin, ShortMaxVectorTests::unsliceUnary);
         }
    +
         static short[] unsliceBinary(short[] a, short[] b, int origin, int part, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4912,6 +4879,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, origin, part, ShortMaxVectorTests::unsliceBinary);
         }
    +
         static short[] unslice(short[] a, short[] b, int origin, int part, boolean[] mask, int idx) {
             short[] res = new short[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    @@ -4969,36 +4937,14 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, origin, part, mask, ShortMaxVectorTests::unslice);
         }
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
         static short BITWISE_BLEND(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
    +
         static short bitwiseBlend(short a, short b, short c) {
             return (short)((a&~(c))|(b&c));
         }
     
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShortMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5017,6 +4963,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertArraysEquals(r, a, b, c, ShortMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShortMaxVectorTests(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5034,7 +4981,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, ShortMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShortMaxVectorTestsMasked(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5057,9 +5003,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, b, c, mask, ShortMaxVectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShortMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5089,6 +5032,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
             assertAltBroadcastArraysEquals(r, a, b, c, ShortMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShortMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5119,7 +5063,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, ShortMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShortMaxVectorTestsBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5158,9 +5101,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertAltBroadcastArraysEquals(r, a, b, c, mask, ShortMaxVectorTests::BITWISE_BLEND);
         }
     
    -
    -
    -
         @Test(dataProvider = "shortTernaryOpProvider")
         static void BITWISE_BLENDShortMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5175,6 +5115,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
     
             assertDoubleBroadcastArraysEquals(r, a, b, c, ShortMaxVectorTests::BITWISE_BLEND);
         }
    +
         @Test(dataProvider = "shortTernaryOpProvider")
         static void bitwiseBlendShortMaxVectorTestsDoubleBroadcastSmokeTest(IntFunction fa, IntFunction fb, IntFunction fc) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5190,7 +5131,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, ShortMaxVectorTests::bitwiseBlend);
         }
     
    -
         @Test(dataProvider = "shortTernaryOpMaskProvider")
         static void BITWISE_BLENDShortMaxVectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction fa, IntFunction fb,
                                               IntFunction fc, IntFunction fm) {
    @@ -5209,7 +5149,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertDoubleBroadcastArraysEquals(r, a, b, c, mask, ShortMaxVectorTests::BITWISE_BLEND);
         }
     
    -
         static short NEG(short a) {
             return (short)(-((short)a));
         }
    @@ -5322,7 +5261,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, ShortMaxVectorTests::ABS);
         }
     
    -
         static short NOT(short a) {
             return (short)(~((short)a));
         }
    @@ -5331,8 +5269,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             return (short)(~((short)a));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void NOTShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5363,8 +5299,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, ShortMaxVectorTests::not);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void NOTMaskedShortMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5383,14 +5317,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, ShortMaxVectorTests::NOT);
         }
     
    -
    -
         static short ZOMO(short a) {
             return (short)((a==0?0:-1));
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpProvider")
         static void ZOMOShortMaxVectorTests(IntFunction fa) {
             short[] a = fa.apply(SPECIES.length());
    @@ -5406,8 +5336,6 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, ShortMaxVectorTests::ZOMO);
         }
     
    -
    -
         @Test(dataProvider = "shortUnaryOpMaskProvider")
         static void ZOMOMaskedShortMaxVectorTests(IntFunction fa,
                                                     IntFunction fm) {
    @@ -5426,9 +5354,190 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertArraysEquals(r, a, mask, ShortMaxVectorTests::ZOMO);
         }
     
    +    static short BIT_COUNT(short a) {
    +        return (short)(Integer.bitCount((int)a & 0xFFFF));
    +    }
     
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void BIT_COUNTShortMaxVectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
     
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
    +            }
    +        }
     
    +        assertArraysEquals(r, a, ShortMaxVectorTests::BIT_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void BIT_COUNTMaskedShortMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ShortMaxVectorTests::BIT_COUNT);
    +    }
    +
    +    static short TRAILING_ZEROS_COUNT(short a) {
    +        return (short)(TRAILING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void TRAILING_ZEROS_COUNTShortMaxVectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, ShortMaxVectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void TRAILING_ZEROS_COUNTMaskedShortMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ShortMaxVectorTests::TRAILING_ZEROS_COUNT);
    +    }
    +
    +    static short LEADING_ZEROS_COUNT(short a) {
    +        return (short)(LEADING_ZEROS_COUNT_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void LEADING_ZEROS_COUNTShortMaxVectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, ShortMaxVectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void LEADING_ZEROS_COUNTMaskedShortMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ShortMaxVectorTests::LEADING_ZEROS_COUNT);
    +    }
    +
    +    static short REVERSE(short a) {
    +        return (short)(REVERSE_scalar(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSEShortMaxVectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, ShortMaxVectorTests::REVERSE);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSEMaskedShortMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ShortMaxVectorTests::REVERSE);
    +    }
    +
    +    static short REVERSE_BYTES(short a) {
    +        return (short)(Short.reverseBytes(a));
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpProvider")
    +    static void REVERSE_BYTESShortMaxVectorTests(IntFunction fa) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, ShortMaxVectorTests::REVERSE_BYTES);
    +    }
    +
    +    @Test(dataProvider = "shortUnaryOpMaskProvider")
    +    static void REVERSE_BYTESMaskedShortMaxVectorTests(IntFunction fa,
    +                                                IntFunction fm) {
    +        short[] a = fa.apply(SPECIES.length());
    +        short[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                ShortVector av = ShortVector.fromArray(SPECIES, a, i);
    +                av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertArraysEquals(r, a, mask, ShortMaxVectorTests::REVERSE_BYTES);
    +    }
     
         @Test(dataProvider = "shortCompareOpProvider")
         static void ltShortMaxVectorTestsBroadcastSmokeTest(IntFunction fa, IntFunction fb) {
    @@ -5831,6 +5940,23 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             assertMaskReductionArraysEquals(r, a, ShortMaxVectorTests::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompressShortMaxVectorTestsSmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
     
         @DataProvider
         public static Object[][] offsetProvider() {
    @@ -5857,6 +5983,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLongShortMaxVectorTestsSmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -5877,6 +6017,14 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLongShortMaxVectorTestsSmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSizeShortMaxVectorTestsSmokeTest() {
             ShortVector av = ShortVector.zero(SPECIES);
    @@ -5939,4 +6087,3 @@ public class ShortMaxVectorTests extends AbstractVectorTest {
             }
         }
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/VectorReshapeTests.java b/test/jdk/jdk/incubator/vector/VectorReshapeTests.java
    index 36306706037..5d70fa7483c 100644
    --- a/test/jdk/jdk/incubator/vector/VectorReshapeTests.java
    +++ b/test/jdk/jdk/incubator/vector/VectorReshapeTests.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -20,14 +20,13 @@
      * or visit www.oracle.com if you need additional information or have any
      * questions.
      */
    +import java.lang.foreign.MemorySegment;
     import jdk.incubator.vector.*;
     import jdk.internal.vm.annotation.ForceInline;
     import org.testng.Assert;
     import org.testng.annotations.Test;
     import org.testng.annotations.DataProvider;
     
    -import java.lang.invoke.MethodHandles;
    -import java.lang.invoke.VarHandle;
     import java.nio.ByteOrder;
     import java.util.Arrays;
     import java.util.List;
    @@ -37,6 +36,7 @@ import jdk.incubator.vector.VectorSpecies;
     
     /**
      * @test
    + * @enablePreview
      * @modules jdk.incubator.vector
      * @modules java.base/jdk.internal.vm.annotation
      * @run testng/othervm/timeout=240 --add-opens jdk.incubator.vector/jdk.incubator.vector=ALL-UNNAMED
    @@ -332,7 +332,9 @@ public class VectorReshapeTests {
         static 
         void testVectorReshape(VectorSpecies a, VectorSpecies b, byte[] input, byte[] output, boolean lanewise) {
             Class atype = a.elementType(), btype = b.elementType();
    -        Vector av = a.fromByteArray(input, 0, ByteOrder.nativeOrder());
    +        MemorySegment inputMs = MemorySegment.ofArray(input);
    +        MemorySegment outputMs = MemorySegment.ofArray(output);
    +        Vector av = a.fromMemorySegment(inputMs, 0, ByteOrder.nativeOrder());
             int partLimit = partLimit(a, b, lanewise);
             int block = Math.min(a.vectorByteSize(), b.vectorByteSize());
             if (false)
    @@ -347,7 +349,7 @@ public class VectorReshapeTests {
                     Vector bv = (lanewise
                                     ? av.castShape(b, part)
                                     : av.reinterpretShape(b, part));
    -                bv.intoByteArray(output, 0, ByteOrder.nativeOrder());
    +                bv.intoMemorySegment(outputMs, 0, ByteOrder.nativeOrder());
                     // expansion: slice some of the input
                     origin = part * block;
                     expected = Arrays.copyOfRange(input, origin, origin + block);
    @@ -362,7 +364,7 @@ public class VectorReshapeTests {
                     Vector bv = (lanewise
                                     ? av.castShape(b, part)
                                     : av.reinterpretShape(b, part));
    -                bv.intoByteArray(output, 0, ByteOrder.nativeOrder());
    +                bv.intoMemorySegment(outputMs, 0, ByteOrder.nativeOrder());
                     // contraction: unslice the input into part of the output
                     byte[] logical = input;
                     if (lanewise) {
    @@ -380,7 +382,7 @@ public class VectorReshapeTests {
                 Vector bv = (lanewise
                                 ? av.castShape(b, part)
                                 : av.reinterpretShape(b, part));
    -            bv.intoByteArray(output, 0, ByteOrder.nativeOrder());
    +            bv.intoMemorySegment(outputMs, 0, ByteOrder.nativeOrder());
                 // in-place copy, no resize
                 expected = input;
                 origin = 0;
    @@ -709,7 +711,9 @@ public class VectorReshapeTests {
         static 
         void testVectorRebracket(VectorSpecies a, VectorSpecies b, byte[] input, byte[] output, boolean lanewise) {
             Class atype = a.elementType(), btype = b.elementType();
    -        Vector av = a.fromByteArray(input, 0, ByteOrder.nativeOrder());
    +        MemorySegment inputMs = MemorySegment.ofArray(input);
    +        MemorySegment outputMs = MemorySegment.ofArray(output);
    +        Vector av = a.fromMemorySegment(inputMs, 0, ByteOrder.nativeOrder());
             int partLimit = partLimit(a, b, lanewise);
             int block;
             assert(input.length == output.length);
    @@ -736,7 +740,7 @@ public class VectorReshapeTests {
                     Vector bv = (lanewise
                                     ? av.castShape(b, part)
                                     : av.reinterpretShape(b, part));
    -                bv.intoByteArray(output, 0, ByteOrder.nativeOrder());
    +                bv.intoMemorySegment(outputMs, 0, ByteOrder.nativeOrder());
                     // expansion: slice some of the input
                     origin = part * block;
                     expected = Arrays.copyOfRange(input, origin, origin + block);
    @@ -751,7 +755,7 @@ public class VectorReshapeTests {
                     Vector bv = (lanewise
                                     ? av.castShape(b, part)
                                     : av.reinterpretShape(b, part));
    -                bv.intoByteArray(output, 0, ByteOrder.nativeOrder());
    +                bv.intoMemorySegment(outputMs, 0, ByteOrder.nativeOrder());
                     // contraction: unslice the input into part of the output
                     byte[] logical = input;
                     if (lanewise) {
    @@ -769,7 +773,7 @@ public class VectorReshapeTests {
                 Vector bv = (lanewise
                                 ? av.castShape(b, part)
                                 : av.reinterpretShape(b, part));
    -            bv.intoByteArray(output, 0, ByteOrder.nativeOrder());
    +            bv.intoMemorySegment(outputMs, 0, ByteOrder.nativeOrder());
                 // in-place copy, no resize
                 expected = input;
                 origin = 0;
    diff --git a/test/jdk/jdk/incubator/vector/gen-template.sh b/test/jdk/jdk/incubator/vector/gen-template.sh
    index baa18a56b15..8c495bc4f96 100644
    --- a/test/jdk/jdk/incubator/vector/gen-template.sh
    +++ b/test/jdk/jdk/incubator/vector/gen-template.sh
    @@ -1,6 +1,6 @@
     #!/bin/bash
     #
    -# Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
     # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     #
     # This code is free software; you can redistribute it and/or modify it
    @@ -74,6 +74,7 @@ shift_const_template="Shift-Const-op"
     shift_masked_const_template="Shift-Masked-Const-op"
     get_template="Get-op"
     rearrange_template="Rearrange"
    +compressexpand_template="CompressExpand"
     broadcast_template="Broadcast"
     zero_template="Zero"
     slice_template="Slice-op"
    @@ -145,7 +146,7 @@ function replace_variables {
     
       # Guard the test if necessary
       if [ "$guard" != "" ]; then
    -    echo -e "#if[${guard}]\n" >> $output
    +    echo -e "#if[${guard}]" >> $output
       fi
       if [ "$test" != "" ]; then
         sed -e "$sed_prog" < ${filename}.current >> $output
    @@ -166,7 +167,7 @@ function replace_variables {
         fi
       fi
       if [ "$guard" != "" ]; then
    -    echo -e "#end[${guard}]\n" >> $output
    +    echo -e "#end[${guard}]" >> $output
       fi
     
       rm -f ${filename}.current
    @@ -410,6 +411,8 @@ gen_binary_alu_op "AND_NOT" "a \& ~b" "BITWISE"
     gen_binary_alu_op "OR+or"    "a | b"   "BITWISE"
     # Missing:        "OR_UNCHECKED"
     gen_binary_alu_op "XOR"   "a ^ b"   "BITWISE"
    +gen_binary_alu_op "COMPRESS_BITS" "\$Boxtype\$.compress(a, b)" "intOrLong"
    +gen_binary_alu_op "EXPAND_BITS" "\$Boxtype\$.expand(a, b)" "intOrLong"
     # Generate the broadcast versions
     gen_binary_alu_bcst_op "add+withMask" "a + b"
     gen_binary_alu_bcst_op "sub+withMask" "a - b"
    @@ -508,6 +511,9 @@ gen_op_tmpl $blend "blend" ""
     # Rearrange
     gen_op_tmpl $rearrange_template "rearrange" ""
     
    +# Compress/Expand
    +gen_op_tmpl $compressexpand_template "compress_expand" ""
    +
     # Get
     gen_get_op "lane" ""
     
    @@ -562,6 +568,15 @@ gen_unary_alu_op "ABS+abs" "Math.abs((\$type\$)a)"
     gen_unary_alu_op "NOT+not" "~((\$type\$)a)" "BITWISE"
     gen_unary_alu_op "ZOMO" "(a==0?0:-1)" "BITWISE"
     gen_unary_alu_op "SQRT+sqrt" "Math.sqrt((double)a)" "FP"
    +gen_unary_alu_op "BIT_COUNT" "\$Boxtype\$.bitCount(a)" "intOrLong"
    +gen_unary_alu_op "BIT_COUNT" "Integer.bitCount((int)a \& 0xFF)" "byte"
    +gen_unary_alu_op "BIT_COUNT" "Integer.bitCount((int)a \& 0xFFFF)" "short"
    +gen_unary_alu_op "TRAILING_ZEROS_COUNT" "TRAILING_ZEROS_COUNT_scalar(a)" "BITWISE"
    +gen_unary_alu_op "LEADING_ZEROS_COUNT" "LEADING_ZEROS_COUNT_scalar(a)" "BITWISE"
    +gen_unary_alu_op "REVERSE" "REVERSE_scalar(a)" "BITWISE"
    +gen_unary_alu_op "REVERSE_BYTES" "\$Boxtype\$.reverseBytes(a)" "intOrLong"
    +gen_unary_alu_op "REVERSE_BYTES" "\$Boxtype\$.reverseBytes(a)" "short"
    +gen_unary_alu_op "REVERSE_BYTES" "a" "byte"
     
     # Miscellaneous Smoke Tests
     gen_op_tmpl $miscellaneous_template "MISC" "" ""
    diff --git a/test/jdk/jdk/incubator/vector/gen-tests.sh b/test/jdk/jdk/incubator/vector/gen-tests.sh
    index d02f0c519fe..583ab0c0110 100644
    --- a/test/jdk/jdk/incubator/vector/gen-tests.sh
    +++ b/test/jdk/jdk/incubator/vector/gen-tests.sh
    @@ -251,4 +251,3 @@ do
     done
     
     rm -fr build
    -
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Binary-Broadcast-op-math.template b/test/jdk/jdk/incubator/vector/templates/Unit-Binary-Broadcast-op-math.template
    index 7964661ece7..f8015a1acd4 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Binary-Broadcast-op-math.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Binary-Broadcast-op-math.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$BinaryOpProvider")
         static void [[TEST]]$vectorteststype$BroadcastSmokeTest(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb) {
     [[KERNEL]]
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Binary-op-math.template b/test/jdk/jdk/incubator/vector/templates/Unit-Binary-op-math.template
    index 6d845a652e9..a3d44526db9 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Binary-op-math.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Binary-op-math.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]($type$ a, $type$ b) {
             return ($type$)([[TEST_OP]]);
         }
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Binary-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Binary-op.template
    index aa7dc156cfe..b070f09162e 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Binary-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Binary-op.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]($type$ a, $type$ b) {
             return ($type$)([[TEST_OP]]);
         }
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-BoolReduction-Scalar-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-BoolReduction-Scalar-op.template
    index dbfe9757962..c359bce0347 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-BoolReduction-Scalar-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-BoolReduction-Scalar-op.template
    @@ -1,3 +1,4 @@
    +
         static boolean [[TEST]](boolean[] a, int idx) {
             boolean res = [[TEST_INIT]];
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-BoolReduction-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-BoolReduction-op.template
    index b3127c1383c..a3db99a5ed8 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-BoolReduction-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-BoolReduction-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "boolUnaryOpProvider")
         static void [[TEST]]$vectorteststype$(IntFunction fm) {
     [[KERNEL]]
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Broadcast.template b/test/jdk/jdk/incubator/vector/templates/Unit-Broadcast.template
    index a5748c3f8ae..bfa06001a82 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Broadcast.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Broadcast.template
    @@ -4,7 +4,3 @@
     [[KERNEL]]
             assertBroadcastArraysEquals(r, a);
         }
    -
    -
    -
    -
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template
    index ca0b6afd9ca..e3fcdf57e83 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template
    @@ -15,7 +15,6 @@
             }
         }
     
    -
         @Test(dataProvider = "$type$CompareOpMaskProvider")
         static void [[TEST]]$vectorteststype$BroadcastMaskedSmokeTest(IntFunction<$type$[]> fa,
                                     IntFunction<$type$[]> fb, IntFunction fm) {
    @@ -53,7 +52,6 @@
             }
         }
     
    -
         @Test(dataProvider = "$type$CompareOpMaskProvider")
         static void [[TEST]]$vectorteststype$BroadcastLongMaskedSmokeTest(IntFunction<$type$[]> fa,
                                     IntFunction<$type$[]> fb, IntFunction fm) {
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template
    index 3b201c630b5..b34658ffc4c 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$CompareOpMaskProvider")
         static void [[TEST]]$vectorteststype$Masked(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb,
                                                     IntFunction fm) {
    @@ -20,4 +21,3 @@
                 }
             }
         }
    -
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template b/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template
    index 8132a850be6..47ddfaf4ab0 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template
    @@ -17,4 +17,3 @@
                 }
             }
         }
    -
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-CompressExpand.template b/test/jdk/jdk/incubator/vector/templates/Unit-CompressExpand.template
    new file mode 100644
    index 00000000000..84de5ad1b81
    --- /dev/null
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-CompressExpand.template
    @@ -0,0 +1,36 @@
    +
    +    @Test(dataProvider = "$type$UnaryOpMaskProvider")
    +    static void compress$vectorteststype$(IntFunction<$type$[]> fa,
    +                                                IntFunction fm) {
    +        $type$[] a = fa.apply(SPECIES.length());
    +        $type$[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask<$Wideboxtype$> vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
    +                av.compress(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertcompressArraysEquals(r, a, mask, SPECIES.length());
    +    }
    +
    +    @Test(dataProvider = "$type$UnaryOpMaskProvider")
    +    static void expand$vectorteststype$(IntFunction<$type$[]> fa,
    +                                                IntFunction fm) {
    +        $type$[] a = fa.apply(SPECIES.length());
    +        $type$[] r = fr.apply(SPECIES.length());
    +        boolean[] mask = fm.apply(SPECIES.length());
    +        VectorMask<$Wideboxtype$> vmask = VectorMask.fromArray(SPECIES, mask, 0);
    +
    +        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
    +                av.expand(vmask).intoArray(r, i);
    +            }
    +        }
    +
    +        assertexpandArraysEquals(r, a, mask, SPECIES.length());
    +    }
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Get-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Get-op.template
    index 9feb403171c..ec311693f4c 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Get-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Get-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$UnaryOpProvider")
         static void get$vectorteststype$(IntFunction<$type$[]> fa) {
     [[KERNEL]]
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template b/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template
    index d72ce5bd085..3a8b1dd17d1 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template
    @@ -484,6 +484,23 @@
             assertMaskReductionArraysEquals(r, a, $vectorteststype$::maskFirstTrue);
         }
     
    +    @Test(dataProvider = "maskProvider")
    +    static void maskCompress$vectorteststype$SmokeTest(IntFunction fa) {
    +        int trueCount = 0;
    +        boolean[] a = fa.apply(SPECIES.length());
    +
    +        for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
    +            for (int i = 0; i < a.length; i += SPECIES.length()) {
    +                var vmask = SPECIES.loadMask(a, i);
    +                trueCount = vmask.trueCount();
    +                var rmask = vmask.compress();
    +                for (int j = 0; j < SPECIES.length(); j++)  {
    +                    Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
    +                }
    +            }
    +        }
    +    }
    +
     #if[!MaxBit]
         @DataProvider
         public static Object[][] longMaskProvider() {
    @@ -528,6 +545,20 @@
             }
         }
     
    +    @Test(dataProvider = "offsetProvider")
    +    static void indexInRangeLong$vectorteststype$SmokeTest(int offset) {
    +        long limit = SPECIES.length() * BUFFER_REPS;
    +        for (long i = 0; i < limit; i += SPECIES.length()) {
    +            var actualMask = SPECIES.indexInRange(i + offset, limit);
    +            var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
    +            assert(actualMask.equals(expectedMask));
    +            for (int j = 0; j < SPECIES.length(); j++)  {
    +                long index = i + j + offset;
    +                Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
    +            }
    +        }
    +    }
    +
         @DataProvider
         public static Object[][] lengthProvider() {
             return new Object[][]{
    @@ -548,6 +579,14 @@
             Assert.assertEquals(actualLoopBound, expectedLoopBound);
         }
     
    +    @Test(dataProvider = "lengthProvider")
    +    static void loopBoundLong$vectorteststype$SmokeTest(int _length) {
    +        long length = _length;
    +        long actualLoopBound = SPECIES.loopBound(length);
    +        long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
    +        Assert.assertEquals(actualLoopBound, expectedLoopBound);
    +    }
    +
         @Test
         static void ElementSize$vectorteststype$SmokeTest() {
             $abstractvectortype$ av = $abstractvectortype$.zero(SPECIES);
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Masked-op-func.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Masked-op-func.template
    index 70ffa79bf6f..8af236eb0e3 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Masked-op-func.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Masked-op-func.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$UnaryOpMaskProvider")
         static void [[TEST]]Reduce$vectorteststype$Masked(IntFunction<$type$[]> fa, IntFunction fm) {
     [[KERNEL]]
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Masked-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Masked-op.template
    index 70ffa79bf6f..8af236eb0e3 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Masked-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Masked-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$UnaryOpMaskProvider")
         static void [[TEST]]Reduce$vectorteststype$Masked(IntFunction<$type$[]> fa, IntFunction fm) {
     [[KERNEL]]
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-Masked-op-func.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-Masked-op-func.template
    index 00b8ed390bc..1565c9f3551 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-Masked-op-func.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-Masked-op-func.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]ReduceMasked($type$[] a, int idx, boolean[] mask) {
             $type$ res = [[TEST_INIT]];
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-Masked-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-Masked-op.template
    index 9f63a493f24..ab383e61256 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-Masked-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-Masked-op.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]ReduceMasked($type$[] a, int idx, boolean[] mask) {
             $type$ res = [[TEST_INIT]];
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-op-func.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-op-func.template
    index 2abdcd295b4..63d154df112 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-op-func.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-op-func.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]Reduce($type$[] a, int idx) {
             $type$ res = [[TEST_INIT]];
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-op.template
    index 244b7f353be..88586fa8129 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-Scalar-op.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]Reduce($type$[] a, int idx) {
             $type$ res = [[TEST_INIT]];
             for (int i = idx; i < (idx + SPECIES.length()); i++) {
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template
    index b86248f3f09..e6bcdb83c2e 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$UnaryOpProvider")
         static void [[TEST]]Reduce$vectorteststype$(IntFunction<$type$[]> fa) {
     [[KERNEL]]
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template
    index b86248f3f09..e6bcdb83c2e 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$UnaryOpProvider")
         static void [[TEST]]Reduce$vectorteststype$(IntFunction<$type$[]> fa) {
     [[KERNEL]]
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Shift-Scalar-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Shift-Scalar-op.template
    index ba22694f29d..0dc082deac4 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Shift-Scalar-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Shift-Scalar-op.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]($type$ a, $type$ b) {
             return ($type$)([[TEST_OP]]);
         }
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Shift-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Shift-op.template
    index bee542c2586..b3d8c971f4d 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Shift-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Shift-op.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]_unary($type$ a, $type$ b) {
             return ($type$)([[TEST_OP]]);
         }
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Single-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Single-op.template
    index 5c60e43c4ed..cc0842c78c9 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Single-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Single-op.template
    @@ -1,3 +1,4 @@
    +
         static $type$[] [[TEST]]($type$ val) {
             $type$[] res = new $type$[SPECIES.length()];
             res[0] = val;
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Slice-Masked-bop.template b/test/jdk/jdk/incubator/vector/templates/Unit-Slice-Masked-bop.template
    index 08ef495038b..5356d5aa5f4 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Slice-Masked-bop.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Slice-Masked-bop.template
    @@ -1,3 +1,4 @@
    +
         static $type$[] [[TEST]]($type$[] a, $type$[] b, int origin, boolean[] mask, int idx) {
             $type$[] res = new $type$[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Slice-bop.template b/test/jdk/jdk/incubator/vector/templates/Unit-Slice-bop.template
    index 7382e86c046..25faf52f656 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Slice-bop.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Slice-bop.template
    @@ -1,3 +1,4 @@
    +
         static $type$[] [[TEST]]($type$[] a, $type$[] b, int origin, int idx) {
             $type$[] res = new $type$[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Slice-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Slice-op.template
    index 6ee07f388b9..ea0a69c5911 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Slice-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Slice-op.template
    @@ -1,3 +1,4 @@
    +
         static $type$[] [[TEST]]($type$[] a, int origin, int idx) {
             $type$[] res = new $type$[SPECIES.length()];
             for (int i = 0; i < SPECIES.length(); i++){
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Broadcast-Masked-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Broadcast-Masked-op.template
    index 2bd267d574e..0d771c091f1 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Broadcast-Masked-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Broadcast-Masked-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$TernaryOpMaskProvider")
         static void [[TEST]]$vectorteststype$BroadcastMaskedSmokeTest(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb,
                                               IntFunction<$type$[]> fc, IntFunction fm) {
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Broadcast-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Broadcast-op.template
    index 0815e57c50f..1f4e15a7ec9 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Broadcast-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Broadcast-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$TernaryOpProvider")
         static void [[TEST]]$vectorteststype$BroadcastSmokeTest(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb, IntFunction<$type$[]> fc) {
             $type$[] a = fa.apply(SPECIES.length());
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Double-Broadcast-Masked-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Double-Broadcast-Masked-op.template
    index 706a39d616a..dbb9ca01a2c 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Double-Broadcast-Masked-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Double-Broadcast-Masked-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$TernaryOpMaskProvider")
         static void [[TEST]]$vectorteststype$DoubleBroadcastMaskedSmokeTest(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb,
                                               IntFunction<$type$[]> fc, IntFunction fm) {
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Double-Broadcast-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Double-Broadcast-op.template
    index 9c2fd9312b4..3693550755e 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Double-Broadcast-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Double-Broadcast-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$TernaryOpProvider")
         static void [[TEST]]$vectorteststype$DoubleBroadcastSmokeTest(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb, IntFunction<$type$[]> fc) {
     #if[double]
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Masked-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Masked-op.template
    index 1b079e965d4..9a498022f06 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Masked-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Masked-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$TernaryOpMaskProvider")
         static void [[TEST]]$vectorteststype$Masked(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb,
                                               IntFunction<$type$[]> fc, IntFunction fm) {
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Scalar-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Scalar-op.template
    index 1212435caa9..758c8895974 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Scalar-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-Scalar-op.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]($type$ a, $type$ b, $type$ c) {
             return ($type$)([[TEST_OP]]);
         }
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-op.template
    index 386ceff6a34..fddafda9ad4 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Ternary-op.template
    @@ -1,3 +1,4 @@
    +
         @Test(dataProvider = "$type$TernaryOpProvider")
         static void [[TEST]]$vectorteststype$(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb, IntFunction<$type$[]> fc) {
     #if[double]
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Test.template b/test/jdk/jdk/incubator/vector/templates/Unit-Test.template
    index c91be6191d2..080773ede1a 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Test.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Test.template
    @@ -1,3 +1,4 @@
    +
         static boolean test[[TEST]]($type$ a) {
             return [[TEST_OP]];
         }
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Unary-op-math.template b/test/jdk/jdk/incubator/vector/templates/Unit-Unary-op-math.template
    index 543ba9a7715..52293d9f614 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Unary-op-math.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Unary-op-math.template
    @@ -1,3 +1,4 @@
    +
         static $type$ [[TEST]]($type$ a) {
             return ($type$)([[TEST_OP]]);
         }
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-Masked-bop.template b/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-Masked-bop.template
    index 760a5393a11..d2156f641a7 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-Masked-bop.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-Masked-bop.template
    @@ -1,3 +1,4 @@
    +
         static $type$[] [[TEST]]($type$[] a, $type$[] b, int origin, int part, boolean[] mask, int idx) {
             $type$[] res = new $type$[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-bop.template b/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-bop.template
    index e723cfd341c..408199f8376 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-bop.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-bop.template
    @@ -1,3 +1,4 @@
    +
         static $type$[] [[TEST]]($type$[] a, $type$[] b, int origin, int part, int idx) {
             $type$[] res = new $type$[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-op.template
    index 60e7bba21b6..f727dae2470 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-op.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Unslice-op.template
    @@ -1,3 +1,4 @@
    +
         static $type$[] [[TEST]]($type$[] a, int origin, int idx) {
             $type$[] res = new $type$[SPECIES.length()];
             for (int i = 0, j = 0; i < SPECIES.length(); i++){
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template b/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template
    index 2cc390cbe12..a277d66ae3e 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template
    @@ -4,7 +4,3 @@
     [[KERNEL]]
             Assert.assertEquals(a, r);
         }
    -
    -
    -
    -
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-footer.template b/test/jdk/jdk/incubator/vector/templates/Unit-footer.template
    index 7e9861c991b..5c34318c214 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-footer.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-footer.template
    @@ -1,2 +1 @@
     }
    -
    diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-header.template b/test/jdk/jdk/incubator/vector/templates/Unit-header.template
    index 8b20bbfc469..0f460c231dc 100644
    --- a/test/jdk/jdk/incubator/vector/templates/Unit-header.template
    +++ b/test/jdk/jdk/incubator/vector/templates/Unit-header.template
    @@ -89,7 +89,9 @@ public class $vectorteststype$ extends AbstractVectorTest {
         private static final int Max = 256;  // juts so we can do N/$bits$
     #end[MaxBit]
     
    +#if[BITWISE]
         private static final $type$ CONST_SHIFT = $Boxtype$.SIZE / 2;
    +#end[BITWISE]
     
         static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / $bits$);
     
    @@ -292,6 +294,55 @@ public class $vectorteststype$ extends AbstractVectorTest {
             }
         }
     
    +    static void assertcompressArraysEquals($type$[] r, $type$[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + k], a[i + j]);
    +                        k++;
    +                    }
    +                }
    +                for (; k < vector_len; k++) {
    +                    Assert.assertEquals(r[i + k], ($type$)0);
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + k;
    +            if (m[(i + j) % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], ($type$)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
    +    static void assertexpandArraysEquals($type$[] r, $type$[] a, boolean[] m, int vector_len) {
    +        int i = 0, j = 0, k = 0;
    +        try {
    +            for (; i < a.length; i += vector_len) {
    +                k = 0;
    +                for (j = 0; j < vector_len; j++) {
    +                    if (m[(i + j) % SPECIES.length()]) {
    +                        Assert.assertEquals(r[i + j], a[i + k]);
    +                        k++;
    +                    } else {
    +                        Assert.assertEquals(r[i + j], ($type$)0);
    +                    }
    +                }
    +            }
    +        } catch (AssertionError e) {
    +            int idx = i + j;
    +            if (m[idx % SPECIES.length()]) {
    +                Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
    +            } else {
    +                Assert.assertEquals(r[idx], ($type$)0, "at index #" + idx);
    +            }
    +        }
    +    }
    +
         static void assertSelectFromArraysEquals($type$[] r, $type$[] a, $type$[] order, int vector_len) {
             int i = 0, j = 0;
             try {
    @@ -1065,8 +1116,8 @@ public class $vectorteststype$ extends AbstractVectorTest {
                 Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
             }
         }
    -
     #if[!Double]
    +
         static void assertArraysEquals(double[] r, $type$[] a, int offs) {
             int i = 0;
             try {
    @@ -1079,7 +1130,6 @@ public class $vectorteststype$ extends AbstractVectorTest {
         }
     #end[!Double]
     
    -
         static $bitstype$ bits($type$ e) {
             return {#if[FP]? $Type$.$type$To$Bitstype$Bits(e): e};
         }
    @@ -1173,9 +1223,9 @@ public class $vectorteststype$ extends AbstractVectorTest {
                     })).
                     toArray(Object[][]::new);
         }
    -
     #if[!Int]
     #if[!byteOrShort]
    +
         @DataProvider
         public Object[][] $type$toIntUnaryOpProvider() {
             return INT_$TYPE$_GENERATORS.stream().
    @@ -1184,8 +1234,8 @@ public class $vectorteststype$ extends AbstractVectorTest {
         }
     #end[!byteOrShort]
     #end[!Int]
    -
     #if[FP]
    +
         @DataProvider
         public Object[][] $type$toLongUnaryOpProvider() {
             return LONG_$TYPE$_GENERATORS.stream().
    @@ -1238,8 +1288,8 @@ public class $vectorteststype$ extends AbstractVectorTest {
                     }))).
                     toArray(Object[][]::new);
         }
    -
     #if[!Int]
    +
         static final List> $TYPE$_SHUFFLE_GENERATORS = List.of(
                 withToStringBi("shuffle[random]", (Integer l, Integer m) -> {
                     $type$[] a = new $type$[l];
    @@ -1273,7 +1323,6 @@ public class $vectorteststype$ extends AbstractVectorTest {
                     }))).
                     toArray(Object[][]::new);
         }
    -
     #end[!Int]
     
         static final List> $TYPE$_COMPARE_GENERATORS = List.of(
    @@ -1405,15 +1454,15 @@ public class $vectorteststype$ extends AbstractVectorTest {
             int length = BUFFER_REPS * vl;
             return new boolean[length];
         };
    -
     #if[!Long]
    +
         static final IntFunction lfr = (vl) -> {
             int length = BUFFER_REPS * vl;
             return new long[length];
         };
     #end[!Long]
    -
     #if[BITWISE]
    +
         static void replaceZero($type$[] a, $type$ v) {
             for (int i = 0; i < a.length; i++) {
                 if (a[i] == 0) {
    @@ -1451,6 +1500,49 @@ public class $vectorteststype$ extends AbstractVectorTest {
     #else[short]
             return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
     #end[short]
    +#end[intOrLong]
    +    }
    +
    +    static $type$ TRAILING_ZEROS_COUNT_scalar($type$ a) {
    +#if[intOrLong]
    +        return $Wideboxtype$.numberOfTrailingZeros(a);
    +#else[intOrLong]
    +#if[short]
    +        return (short) (a != 0 ? Integer.numberOfTrailingZeros(a) : 16);
    +#else[short]
    +        return (byte) (a != 0 ? Integer.numberOfTrailingZeros(a) : 8);
    +#end[short]
    +#end[intOrLong]
    +    }
    +
    +    static $type$ LEADING_ZEROS_COUNT_scalar($type$ a) {
    +#if[intOrLong]
    +        return $Wideboxtype$.numberOfLeadingZeros(a);
    +#else[intOrLong]
    +#if[short]
    +        return (short) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 16 : 0);
    +#else[short]
    +        return (byte) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 24 : 0);
    +#end[short]
    +#end[intOrLong]
    +    }
    +
    +    static $type$ REVERSE_scalar($type$ a) {
    +#if[intOrLong]
    +        return $Wideboxtype$.reverse(a);
    +#else[intOrLong]
    +#if[short]
    +        $type$ b = ROL_scalar(a, ($type$) 8);
    +        b = (short) (((b & 0x5555) << 1) | ((b & 0xAAAA) >>> 1));
    +        b = (short) (((b & 0x3333) << 2) | ((b & 0xCCCC) >>> 2));
    +        b = (short) (((b & 0x0F0F) << 4) | ((b & 0xF0F0) >>> 4));
    +        return b;
    +#else[short]
    +        $type$ b = ($type$) ROL_scalar(a, ($type$) 4);
    +        b = (byte) (((b & 0x55) << 1) | ((b & 0xAA) >>> 1));
    +        b = (byte) (((b & 0x33) << 2) | ((b & 0xCC) >>> 2));
    +        return b;
    +#end[short]
     #end[intOrLong]
         }
     #end[BITWISE]
    @@ -1478,8 +1570,8 @@ public class $vectorteststype$ extends AbstractVectorTest {
         static boolean ge($type$ a, $type$ b) {
             return a >= b;
         }
    -
     #if[!FP]
    +
         static boolean ult($type$ a, $type$ b) {
             return $Boxtype$.compareUnsigned(a, b) < 0;
         }
    @@ -1593,8 +1685,8 @@ public class $vectorteststype$ extends AbstractVectorTest {
             Assert.assertEquals(asIntegral.species(), SPECIES);
     #end[FP]
         }
    -
     #if[FP]
    +
         @Test
         void viewAsFloatingLanesTest() {
             Vector asFloating = SPECIES.zero().viewAsFloatingLanes();
    @@ -1602,11 +1694,13 @@ public class $vectorteststype$ extends AbstractVectorTest {
         }
     #else[FP]
     #if[byteOrShort]
    +
         @Test(expectedExceptions = UnsupportedOperationException.class)
         void viewAsFloatingLanesTest() {
             SPECIES.zero().viewAsFloatingLanes();
         }
     #else[byteOrShort]
    +
         @Test
         void viewAsFloatingLanesTest() {
             Vector asFloating = SPECIES.zero().viewAsFloatingLanes();
    @@ -1618,8 +1712,8 @@ public class $vectorteststype$ extends AbstractVectorTest {
         }
     #end[byteOrShort]
     #end[FP]
    -
     #if[BITWISE]
    +
         @Test
         // Test div by 0.
         static void bitwiseDivByZeroSmokeTest() {
    diff --git a/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template b/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template
    index 49502217954..7e27bfe96bf 100644
    --- a/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template
    +++ b/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template
    @@ -36,6 +36,9 @@
     
     #warn This file is preprocessed before being compiled
     
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.lang.foreign.ValueLayout;
     import jdk.incubator.vector.$Type$Vector;
     import jdk.incubator.vector.VectorMask;
     #if[MaxBit]
    @@ -48,16 +51,7 @@ import org.testng.Assert;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    -#if[MaxBit]
    -import java.lang.invoke.MethodHandles;
    -import java.lang.invoke.VarHandle;
    -#end[MaxBit]
    -import java.nio.ByteBuffer;
    -#if[!byte]
    -import java.nio.$Type$Buffer;
    -#end[!byte]
     import java.nio.ByteOrder;
    -import java.nio.ReadOnlyBufferException;
     import java.util.List;
     import java.util.function.*;
     
    @@ -73,6 +67,8 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
     
         static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
     
    +    static final ValueLayout.Of$Type$ ELEMENT_LAYOUT = ValueLayout.JAVA_$TYPE$.withBitAlignment(8);
    +
     #if[MaxBit]
         static VectorShape getMaxBit() {
             return VectorShape.S_Max_BIT;
    @@ -94,19 +90,6 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
             }
         }
     
    -#if[!byte]
    -    static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) {
    -        int i = 0;
    -        try {
    -            for (; i < a.length; i++) {
    -                Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0);
    -            }
    -        } catch (AssertionError e) {
    -            Assert.assertEquals(r[i], mask[(i*8/SPECIES.elementSize()) % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i);
    -        }
    -    }
    -#end[!byte]
    -
         static final List> $TYPE$_GENERATORS = List.of(
                 withToString("$type$[i * 5]", (int s) -> {
                     return fill(s * BUFFER_REPS,
    @@ -146,7 +129,7 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
                 })
         );
     
    -    // Relative to byte[] array.length or ByteBuffer.limit()
    +    // Relative to byte[] array.length or MemorySegment.byteSize()
         static final List> BYTE_INDEX_GENERATORS = List.of(
                 withToString("-1", (int l) -> {
                     return -1;
    @@ -217,9 +200,9 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] $type$ByteBufferProvider() {
    +    public Object[][] $type$MemorySegmentProvider() {
             return $TYPE$_GENERATORS.stream().
    -                flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                             flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, bo};
                             }))).
    @@ -227,35 +210,16 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
         }
     
         @DataProvider
    -    public Object[][] $type$ByteBufferMaskProvider() {
    +    public Object[][] $type$MemorySegmentMaskProvider() {
             return BOOLEAN_MASK_GENERATORS.stream().
                     flatMap(fm -> $TYPE$_GENERATORS.stream().
    -                        flatMap(fa -> BYTE_BUFFER_GENERATORS.stream().
    +                        flatMap(fa -> MEMORY_SEGMENT_GENERATORS.stream().
                                     flatMap(fb -> BYTE_ORDER_VALUES.stream().map(bo -> {
                                 return new Object[]{fa, fb, fm, bo};
                             })))).
                     toArray(Object[][]::new);
         }
     
    -    @DataProvider
    -    public Object[][] $type$ByteArrayProvider() {
    -        return $TYPE$_GENERATORS.stream().
    -                flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                    return new Object[]{fa, bo};
    -                })).
    -                toArray(Object[][]::new);
    -    }
    -
    -    @DataProvider
    -    public Object[][] $type$ByteArrayMaskProvider() {
    -        return BOOLEAN_MASK_GENERATORS.stream().
    -                flatMap(fm -> $TYPE$_GENERATORS.stream().
    -                    flatMap(fa -> BYTE_ORDER_VALUES.stream().map(bo -> {
    -                        return new Object[]{fa, fm, bo};
    -                    }))).
    -                toArray(Object[][]::new);
    -    }
    -
         @DataProvider
         public Object[][] $type$ByteProviderForIOOBE() {
             var f = $TYPE$_GENERATORS.get(0);
    @@ -275,32 +239,16 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
                     toArray(Object[][]::new);
         }
     
    -    static ByteBuffer toBuffer($type$[] a, IntFunction fb) {
    -        ByteBuffer bb = fb.apply(a.length * SPECIES.elementSize() / 8);
    -        for ($type$ v : a) {
    -            bb.{#if[byte]?put(v):put$Type$(v)};
    +    static MemorySegment toSegment($type$[] a, IntFunction fb) {
    +        MemorySegment ms = fb.apply(a.length * SPECIES.elementSize() / 8);
    +        for (int i = 0; i < a.length; i++) {
    +            ms.set(ELEMENT_LAYOUT, i * SPECIES.elementSize() / 8 , a[i]);
             }
    -        return bb.clear();
    +        return ms;
         }
     
    -    static $type$[] bufferToArray(ByteBuffer bb) {
    -        $Type$Buffer db = bb{#if[byte]?;:.as$Type$Buffer();}
    -        $type$[] d = new $type$[db.capacity()];
    -        db.get(0, d);
    -        return d;
    -    }
    -
    -    static byte[] toByteArray($type$[] a, IntFunction fb, ByteOrder bo) {
    -        byte[] b = fb.apply(a.length * SPECIES.elementSize() / 8);
    -#if[byte]
    -        $Type$Buffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo);
    -#else[byte]
    -        $Type$Buffer bb = ByteBuffer.wrap(b, 0, b.length).order(bo).as$Type$Buffer();
    -#end[byte]
    -        for ($type$ v : a) {
    -            bb.put(v);
    -        }
    -        return b;
    +    static $type$[] segmentToArray(MemorySegment ms) {
    +        return ms.toArray(ELEMENT_LAYOUT);
         }
     
     
    @@ -340,46 +288,25 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
         }
     
         @DontInline
    -    static $abstractvectortype$ fromByteArray(byte[] a, int i, ByteOrder bo) {
    -        return $abstractvectortype$.fromByteArray(SPECIES, a, i, bo);
    +    static $abstractvectortype$ fromMemorySegment(MemorySegment a, int i, ByteOrder bo) {
    +        return $abstractvectortype$.fromMemorySegment(SPECIES, a, i, bo);
         }
     
         @DontInline
    -    static $abstractvectortype$ fromByteArray(byte[] a, int i, ByteOrder bo, VectorMask<$Boxtype$> m) {
    -        return $abstractvectortype$.fromByteArray(SPECIES, a, i, bo, m);
    +    static $abstractvectortype$ fromMemorySegment(MemorySegment a, int i, ByteOrder bo, VectorMask<$Boxtype$> m) {
    +        return $abstractvectortype$.fromMemorySegment(SPECIES, a, i, bo, m);
         }
     
         @DontInline
    -    static void intoByteArray($abstractvectortype$ v, byte[] a, int i, ByteOrder bo) {
    -        v.intoByteArray(a, i, bo);
    +    static void intoMemorySegment($abstractvectortype$ v, MemorySegment a, int i, ByteOrder bo) {
    +        v.intoMemorySegment(a, i, bo);
         }
     
         @DontInline
    -    static void intoByteArray($abstractvectortype$ v, byte[] a, int i, ByteOrder bo, VectorMask<$Boxtype$> m) {
    -        v.intoByteArray(a, i, bo, m);
    +    static void intoMemorySegment($abstractvectortype$ v, MemorySegment a, int i, ByteOrder bo, VectorMask<$Boxtype$> m) {
    +        v.intoMemorySegment(a, i, bo, m);
         }
     
    -    @DontInline
    -    static $abstractvectortype$ fromByteBuffer(ByteBuffer a, int i, ByteOrder bo) {
    -        return $abstractvectortype$.fromByteBuffer(SPECIES, a, i, bo);
    -    }
    -
    -    @DontInline
    -    static $abstractvectortype$ fromByteBuffer(ByteBuffer a, int i, ByteOrder bo, VectorMask<$Boxtype$> m) {
    -        return $abstractvectortype$.fromByteBuffer(SPECIES, a, i, bo, m);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer($abstractvectortype$ v, ByteBuffer a, int i, ByteOrder bo) {
    -        v.intoByteBuffer(a, i, bo);
    -    }
    -
    -    @DontInline
    -    static void intoByteBuffer($abstractvectortype$ v, ByteBuffer a, int i, ByteOrder bo, VectorMask<$Boxtype$> m) {
    -        v.intoByteBuffer(a, i, bo, m);
    -    }
    -
    -
         @Test(dataProvider = "$type$Provider")
         static void loadStoreArray(IntFunction<$type$[]> fa) {
             $type$[] a = fa.apply(SPECIES.length());
    @@ -550,48 +477,45 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
         }
     
     
    -    @Test(dataProvider = "$type$ByteBufferProvider")
    -    static void loadStoreByteBuffer(IntFunction<$type$[]> fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +    @Test(dataProvider = "$type$MemorySegmentProvider")
    +    static void loadStoreMemorySegment(IntFunction<$type$[]> fa,
    +                                       IntFunction fb,
    +                                       ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = $abstractvectortype$.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo);
    +                $abstractvectortype$ av = $abstractvectortype$.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        Assert.assertEquals(r, a, "Buffers not equal");
    +        long m = r.mismatch(a);
    +        Assert.assertEquals(m, -1, "Segments not equal");
         }
     
         @Test(dataProvider = "$type$ByteProviderForIOOBE")
    -    static void loadByteBufferIOOBE(IntFunction<$type$[]> fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentIOOBE(IntFunction<$type$[]> fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, $Boxtype$.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), $Boxtype$.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = fromByteBuffer(a, i, ByteOrder.nativeOrder());
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                $abstractvectortype$ av = fromMemorySegment(a, i, ByteOrder.nativeOrder());
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder());
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -603,25 +527,25 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "$type$ByteProviderForIOOBE")
    -    static void storeByteBufferIOOBE(IntFunction<$type$[]> fa, IntFunction fi) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentIOOBE(IntFunction<$type$[]> fa, IntFunction fi) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, $Boxtype$.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), $Boxtype$.SIZE, MemorySession.openImplicit());
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = $abstractvectortype$.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder());
    +                $abstractvectortype$ av = $abstractvectortype$.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.limit());
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, (int) a.byteSize());
             try {
    -            $abstractvectortype$ av = $abstractvectortype$.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, r, index, ByteOrder.nativeOrder());
    +            $abstractvectortype$ av = $abstractvectortype$.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, r, index, ByteOrder.nativeOrder());
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -632,70 +556,61 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
             }
         }
     
    -
    -    @Test(dataProvider = "$type$ByteBufferMaskProvider")
    -    static void loadStoreByteBufferMask(IntFunction<$type$[]> fa,
    -                                        IntFunction fb,
    -                                        IntFunction fm,
    -                                        ByteOrder bo) {
    +    @Test(dataProvider = "$type$MemorySegmentMaskProvider")
    +    static void loadStoreMemorySegmentMask(IntFunction<$type$[]> fa,
    +                                           IntFunction fb,
    +                                           IntFunction fm,
    +                                           ByteOrder bo) {
             $type$[] _a = fa.apply(SPECIES.length());
    -        ByteBuffer a = toBuffer(_a, fb);
    -        ByteBuffer r = fb.apply(a.limit());
    +        MemorySegment a = toSegment(_a, fb);
    +        MemorySegment r = fb.apply((int) a.byteSize());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask<$Boxtype$> vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = $abstractvectortype$.fromByteBuffer(SPECIES, a, i, bo, vmask);
    -                av.intoByteBuffer(r, i, bo);
    +                $abstractvectortype$ av = $abstractvectortype$.fromMemorySegment(SPECIES, a, i, bo, vmask);
    +                av.intoMemorySegment(r, i, bo);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
     
     
    -        r = fb.apply(a.limit());
    +        r = fb.apply((int) a.byteSize());
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = $abstractvectortype$.fromByteBuffer(SPECIES, a, i, bo);
    -                av.intoByteBuffer(r, i, bo, vmask);
    +                $abstractvectortype$ av = $abstractvectortype$.fromMemorySegment(SPECIES, a, i, bo);
    +                av.intoMemorySegment(r, i, bo, vmask);
                 }
             }
    -        Assert.assertEquals(a.position(), 0, "Input buffer position changed");
    -        Assert.assertEquals(a.limit(), l, "Input buffer limit changed");
    -        Assert.assertEquals(r.position(), 0, "Result buffer position changed");
    -        Assert.assertEquals(r.limit(), l, "Result buffer limit changed");
    -        assertArraysEquals(bufferToArray(r), _a, mask);
    +        assertArraysEquals(segmentToArray(r), _a, mask);
         }
     
         @Test(dataProvider = "$type$ByteMaskProviderForIOOBE")
    -    static void loadByteBufferMaskIOOBE(IntFunction<$type$[]> fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void loadMemorySegmentMaskIOOBE(IntFunction<$type$[]> fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, $Boxtype$.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), $Boxtype$.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask<$Boxtype$> vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = fromByteBuffer(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteBuffer(r, i, ByteOrder.nativeOrder());
    +                $abstractvectortype$ av = fromMemorySegment(a, i, ByteOrder.nativeOrder(), vmask);
    +                av.intoMemorySegment(r, i, ByteOrder.nativeOrder());
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            fromByteBuffer(a, index, ByteOrder.nativeOrder(), vmask);
    +            fromMemorySegment(a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -707,27 +622,27 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
         }
     
         @Test(dataProvider = "$type$ByteMaskProviderForIOOBE")
    -    static void storeByteBufferMaskIOOBE(IntFunction<$type$[]> fa, IntFunction fi, IntFunction fm) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), ByteBuffer::allocateDirect);
    -        ByteBuffer r = ByteBuffer.allocateDirect(a.limit());
    +    static void storeMemorySegmentMaskIOOBE(IntFunction<$type$[]> fa, IntFunction fi, IntFunction fm) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), i -> MemorySegment.allocateNative(i, $Boxtype$.SIZE, MemorySession.openImplicit()));
    +        MemorySegment r = MemorySegment.allocateNative(a.byteSize(), $Boxtype$.SIZE, MemorySession.openImplicit());
             boolean[] mask = fm.apply(SPECIES.length());
             VectorMask<$Boxtype$> vmask = VectorMask.fromValues(SPECIES, mask);
     
    -        int l = a.limit();
    +        int l = (int) a.byteSize();
             int s = SPECIES.vectorByteSize();
     
             for (int ic = 0; ic < INVOC_COUNT; ic++) {
                 for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = $abstractvectortype$.fromByteBuffer(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteBuffer(av, r, i, ByteOrder.nativeOrder(), vmask);
    +                $abstractvectortype$ av = $abstractvectortype$.fromMemorySegment(SPECIES, a, i, ByteOrder.nativeOrder());
    +                intoMemorySegment(av, r, i, ByteOrder.nativeOrder(), vmask);
                 }
             }
     
    -        int index = fi.apply(a.limit());
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.limit(), SPECIES.elementSize() / 8);
    +        int index = fi.apply((int) a.byteSize());
    +        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, (int) a.byteSize(), SPECIES.elementSize() / 8);
             try {
    -            $abstractvectortype$ av = $abstractvectortype$.fromByteBuffer(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteBuffer(av, a, index, ByteOrder.nativeOrder(), vmask);
    +            $abstractvectortype$ av = $abstractvectortype$.fromMemorySegment(SPECIES, a, 0, ByteOrder.nativeOrder());
    +            intoMemorySegment(av, a, index, ByteOrder.nativeOrder(), vmask);
                 if (shouldFail) {
                     Assert.fail("Failed to throw IndexOutOfBoundsException");
                 }
    @@ -738,214 +653,36 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
             }
         }
     
    +    @Test(dataProvider = "$type$MemorySegmentProvider")
    +    static void loadStoreReadonlyMemorySegment(IntFunction<$type$[]> fa,
    +                                               IntFunction fb,
    +                                               ByteOrder bo) {
    +        MemorySegment a = toSegment(fa.apply(SPECIES.length()), fb).asReadOnly();
     
    -    @Test(dataProvider = "$type$ByteBufferProvider")
    -    static void loadStoreReadonlyByteBuffer(IntFunction<$type$[]> fa,
    -                                    IntFunction fb,
    -                                    ByteOrder bo) {
    -        ByteBuffer a = toBuffer(fa.apply(SPECIES.length()), fb).asReadOnlyBuffer();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo)
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(true))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(true));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, SPECIES.maskAll(false))
    +        );
     
    -        try {
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, SPECIES.maskAll(false));
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    -
    -        try {
    -            VectorMask<$Boxtype$> m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    -                    .laneIsValid();
    -            SPECIES.zero().intoByteBuffer(a, 0, bo, m);
    -            Assert.fail("ReadOnlyBufferException expected");
    -        } catch (ReadOnlyBufferException e) {
    -        }
    +        VectorMask<$Boxtype$> m = SPECIES.shuffleFromOp(i -> i % 2 == 0 ? 1 : -1)
    +                .laneIsValid();
    +        Assert.assertThrows(
    +                UnsupportedOperationException.class,
    +                () -> SPECIES.zero().intoMemorySegment(a, 0, bo, m)
    +        );
         }
     
     
    -    @Test(dataProvider = "$type$ByteArrayProvider")
    -    static void loadStoreByteArray(IntFunction<$type$[]> fa,
    -                                    ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = $abstractvectortype$.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo);
    -            }
    -        }
    -        Assert.assertEquals(r, a, "Byte arrays not equal");
    -    }
    -
    -    @Test(dataProvider = "$type$ByteProviderForIOOBE")
    -    static void loadByteArrayIOOBE(IntFunction<$type$[]> fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = fromByteArray(a, i, ByteOrder.nativeOrder());
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "$type$ByteProviderForIOOBE")
    -    static void storeByteArrayIOOBE(IntFunction<$type$[]> fa, IntFunction fi) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = $abstractvectortype$.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBounds(SPECIES.vectorByteSize(), index, a.length);
    -        try {
    -            $abstractvectortype$ av = $abstractvectortype$.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, r, index, ByteOrder.nativeOrder());
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -
    -    @Test(dataProvider = "$type$ByteArrayMaskProvider")
    -    static void loadStoreByteArrayMask(IntFunction<$type$[]> fa,
    -                                  IntFunction fm,
    -                                  ByteOrder bo) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, bo);
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask<$Boxtype$> vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -          for (int i = 0; i < l; i += s) {
    -              $abstractvectortype$ av = $abstractvectortype$.fromByteArray(SPECIES, a, i, bo, vmask);
    -              av.intoByteArray(r, i, bo);
    -          }
    -        }
    -        assertArraysEquals(r, a, mask);
    -
    -
    -        r = new byte[a.length];
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = $abstractvectortype$.fromByteArray(SPECIES, a, i, bo);
    -                av.intoByteArray(r, i, bo, vmask);
    -            }
    -        }
    -        assertArraysEquals(r, a, mask);
    -    }
    -
    -    @Test(dataProvider = "$type$ByteMaskProviderForIOOBE")
    -    static void loadByteArrayMaskIOOBE(IntFunction<$type$[]> fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask<$Boxtype$> vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = fromByteArray(a, i, ByteOrder.nativeOrder(), vmask);
    -                av.intoByteArray(r, i, ByteOrder.nativeOrder());
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            fromByteArray(a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
    -    @Test(dataProvider = "$type$ByteMaskProviderForIOOBE")
    -    static void storeByteArrayMaskIOOBE(IntFunction<$type$[]> fa, IntFunction fi, IntFunction fm) {
    -        byte[] a = toByteArray(fa.apply(SPECIES.length()), byte[]::new, ByteOrder.nativeOrder());
    -        byte[] r = new byte[a.length];
    -        boolean[] mask = fm.apply(SPECIES.length());
    -        VectorMask<$Boxtype$> vmask = VectorMask.fromValues(SPECIES, mask);
    -
    -        int s = SPECIES.vectorByteSize();
    -        int l = a.length;
    -
    -        for (int ic = 0; ic < INVOC_COUNT; ic++) {
    -            for (int i = 0; i < l; i += s) {
    -                $abstractvectortype$ av = $abstractvectortype$.fromByteArray(SPECIES, a, i, ByteOrder.nativeOrder());
    -                intoByteArray(av, r, i, ByteOrder.nativeOrder(), vmask);
    -            }
    -        }
    -
    -        int index = fi.apply(a.length);
    -        boolean shouldFail = isIndexOutOfBoundsForMask(mask, index, a.length, SPECIES.elementSize() / 8);
    -        try {
    -            $abstractvectortype$ av = $abstractvectortype$.fromByteArray(SPECIES, a, 0, ByteOrder.nativeOrder());
    -            intoByteArray(av, a, index, ByteOrder.nativeOrder(), vmask);
    -            if (shouldFail) {
    -                Assert.fail("Failed to throw IndexOutOfBoundsException");
    -            }
    -        } catch (IndexOutOfBoundsException e) {
    -            if (!shouldFail) {
    -                Assert.fail("Unexpected IndexOutOfBoundsException");
    -            }
    -        }
    -    }
    -
         @Test(dataProvider = "maskProvider")
         static void loadStoreMask(IntFunction fm) {
             boolean[] a = fm.apply(SPECIES.length());
    @@ -960,6 +697,7 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest {
             Assert.assertEquals(r, a);
         }
     
    +
         @Test
         static void loadStoreShuffle() {
             IntUnaryOperator fn = a -> a + 5;
    diff --git a/test/lib-test/jdk/test/whitebox/CPUInfoTest.java b/test/lib-test/jdk/test/whitebox/CPUInfoTest.java
    index 3831ab7a2d8..fb4c9506c59 100644
    --- a/test/lib-test/jdk/test/whitebox/CPUInfoTest.java
    +++ b/test/lib-test/jdk/test/whitebox/CPUInfoTest.java
    @@ -63,7 +63,7 @@ public class CPUInfoTest {
                         "vzeroupper",   "avx512_vpopcntdq", "avx512_vpclmulqdq", "avx512_vaes",
                         "avx512_vnni",  "clflush",          "clflushopt",        "clwb",
                         "avx512_vbmi2", "avx512_vbmi",      "rdtscp",            "rdpid",
    -                    "hv"
    +                    "hv",           "fsrm",             "avx512_bitalg",     "gfni"
                         );
                 // @formatter:on
                 // Checkstyle: resume
    diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java
    index fe6617b3c11..f58821b6697 100644
    --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java
    +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java
    @@ -39,7 +39,7 @@ import java.util.function.IntUnaryOperator;
     @State(Scope.Thread)
     @Warmup(iterations = 3, time = 5)
     @Measurement(iterations = 3, time = 5)
    -@Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
    +@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
     public class BlackScholes {
     
         @Param("1024")
    diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskCastOperationsBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskCastOperationsBenchmark.java
    new file mode 100644
    index 00000000000..93871392f26
    --- /dev/null
    +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskCastOperationsBenchmark.java
    @@ -0,0 +1,224 @@
    +/*
    + *  Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
    + *  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    + *
    + *  This code is free software; you can redistribute it and/or modify it
    + *  under the terms of the GNU General Public License version 2 only, as
    + *  published by the Free Software Foundation.
    + *
    + *  This code is distributed in the hope that it will be useful, but WITHOUT
    + *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    + *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    + *  version 2 for more details (a copy is included in the LICENSE file that
    + *  accompanied this code).
    + *
    + *  You should have received a copy of the GNU General Public License version
    + *  2 along with this work; if not, write to the Free Software Foundation,
    + *  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    + *
    + *  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    + *  or visit www.oracle.com if you need additional information or have any
    + *  questions.
    + *
    + */
    +
    +package org.openjdk.bench.jdk.incubator.vector;
    +
    +import jdk.incubator.vector.*;
    +import java.util.concurrent.TimeUnit;
    +import org.openjdk.jmh.annotations.*;
    +
    +@OutputTimeUnit(TimeUnit.MILLISECONDS)
    +@State(Scope.Thread)
    +@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
    +public class MaskCastOperationsBenchmark {
    +    VectorMask bmask64;
    +    VectorMask bmask128;
    +    VectorMask bmask256;
    +
    +    VectorMask smask64;
    +    VectorMask smask128;
    +    VectorMask smask256;
    +    VectorMask smask512;
    +
    +    VectorMask imask64;
    +    VectorMask imask128;
    +    VectorMask imask256;
    +    VectorMask imask512;
    +
    +    VectorMask lmask128;
    +    VectorMask lmask256;
    +    VectorMask lmask512;
    +
    +    static final boolean [] mask_arr = {
    +       false, false, false, true, false, false, false, false,
    +       false, false, false, true, false, false, false, false,
    +       false, false, false, true, false, false, false, false,
    +       true, true, true, true, true, true, true, true,
    +       true, true, true, true, true, true, true, true,
    +       false, false, false, true, false, false, false, false,
    +       false, false, false, true, false, false, false, false,
    +       false, false, false, true, false, false, false, false
    +    };
    +
    +    @Setup(Level.Trial)
    +    public void BmSetup() {
    +        bmask64 = VectorMask.fromArray(ByteVector.SPECIES_64, mask_arr, 0);
    +        bmask128 = VectorMask.fromArray(ByteVector.SPECIES_128, mask_arr, 0);
    +        bmask256 = VectorMask.fromArray(ByteVector.SPECIES_256, mask_arr, 0);
    +
    +        smask64 = VectorMask.fromArray(ShortVector.SPECIES_64, mask_arr, 0);
    +        smask128 = VectorMask.fromArray(ShortVector.SPECIES_128, mask_arr, 0);
    +        smask256 = VectorMask.fromArray(ShortVector.SPECIES_256, mask_arr, 0);
    +        smask512 = VectorMask.fromArray(ShortVector.SPECIES_512, mask_arr, 0);
    +
    +        imask64 = VectorMask.fromArray(IntVector.SPECIES_64, mask_arr, 0);
    +        imask128 = VectorMask.fromArray(IntVector.SPECIES_128, mask_arr, 0);
    +        imask256 = VectorMask.fromArray(IntVector.SPECIES_256, mask_arr, 0);
    +        imask512 = VectorMask.fromArray(IntVector.SPECIES_512, mask_arr, 0);
    +
    +        lmask128 = VectorMask.fromArray(LongVector.SPECIES_128, mask_arr, 0);
    +        lmask256 = VectorMask.fromArray(LongVector.SPECIES_256, mask_arr, 0);
    +        lmask512 = VectorMask.fromArray(LongVector.SPECIES_512, mask_arr, 0);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastByte64ToShort128() {
    +        return bmask64.cast(ShortVector.SPECIES_128);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastByte64ToInteger256() {
    +        return bmask64.cast(IntVector.SPECIES_256);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastByte64ToLong512() {
    +        return bmask64.cast(LongVector.SPECIES_512);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastByte128ToShort256() {
    +        return bmask128.cast(ShortVector.SPECIES_256);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastByte128ToInteger512() {
    +        return bmask128.cast(IntVector.SPECIES_512);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastByte256ToShort512() {
    +        return bmask256.cast(ShortVector.SPECIES_512);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastShort64ToInteger128() {
    +        return smask64.cast(IntVector.SPECIES_128);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastShort64ToLong256() {
    +        return smask64.cast(LongVector.SPECIES_256);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastShort128ToByte64() {
    +        return smask128.cast(ByteVector.SPECIES_64);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastShort128ToInteger256() {
    +        return smask128.cast(IntVector.SPECIES_256);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastShort128ToLong512() {
    +        return smask128.cast(LongVector.SPECIES_512);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastShort256ToByte128() {
    +        return smask256.cast(ByteVector.SPECIES_128);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastShort256ToInteger512() {
    +        return smask256.cast(IntVector.SPECIES_512);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastShort512ToByte256() {
    +        return smask512.cast(ByteVector.SPECIES_256);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastInteger64ToLong128() {
    +        return imask64.cast(LongVector.SPECIES_128);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastInteger128ToShort64() {
    +        return imask128.cast(ShortVector.SPECIES_64);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastInteger128ToLong256() {
    +        return imask128.cast(LongVector.SPECIES_256);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastInteger256ToByte64() {
    +        return imask256.cast(ByteVector.SPECIES_64);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastInteger256ToShort128() {
    +        return imask256.cast(ShortVector.SPECIES_128);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastInteger256ToLong512() {
    +        return imask256.cast(LongVector.SPECIES_512);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastInteger512ToByte128() {
    +        return imask512.cast(ByteVector.SPECIES_128);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastInteger512ToShort256() {
    +        return imask512.cast(ShortVector.SPECIES_256);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastLong128ToInteger64() {
    +        return lmask128.cast(IntVector.SPECIES_64);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastLong256ToShort64() {
    +        return lmask256.cast(ShortVector.SPECIES_64);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastLong256ToInteger128() {
    +        return lmask256.cast(IntVector.SPECIES_128);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastLong512ToByte64() {
    +        return lmask512.cast(ByteVector.SPECIES_64);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastLong512ToShort128() {
    +        return lmask512.cast(ShortVector.SPECIES_128);
    +    }
    +
    +    @Benchmark
    +    public VectorMask microMaskCastLong512ToInteger256() {
    +        return lmask512.cast(IntVector.SPECIES_256);
    +    }
    +}
    diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java
    index 5fa4741fad2..373bd5017cc 100644
    --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java
    +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java
    @@ -31,6 +31,7 @@ import org.openjdk.jmh.infra.Blackhole;
     
     @OutputTimeUnit(TimeUnit.MILLISECONDS)
     @State(Scope.Thread)
    +@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
     public class MaskQueryOperationsBenchmark {
         @Param({"128","256","512"})
         int bits;
    @@ -155,4 +156,23 @@ public class MaskQueryOperationsBenchmark {
         public int testLastTrueLong(Blackhole bh) {
             return lmask.lastTrue();
         }
    +
    +    @Benchmark
    +    public long testToLongByte(Blackhole bh) {
    +        return bmask.toLong();
    +    }
    +
    +    @Benchmark
    +    public long testToLongShort(Blackhole bh) {
    +        return smask.toLong();
    +    }
    +    @Benchmark
    +    public long testToLongInt(Blackhole bh) {
    +        return imask.toLong();
    +    }
    +    @Benchmark
    +    public long testToLongLong(Blackhole bh) {
    +        return lmask.toLong();
    +    }
    +
     }
    diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java
    index 97bfc526808..97922c2f9ee 100644
    --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java
    +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java
    @@ -32,6 +32,7 @@ import java.util.Random;
     @BenchmarkMode(Mode.Throughput)
     @OutputTimeUnit(TimeUnit.SECONDS)
     @State(Scope.Thread)
    +@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
     public class MaskedLogicOpts {
         @Param({"256","512","1024"})
         private int ARRAYLEN;
    diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java
    new file mode 100644
    index 00000000000..a73beddfe87
    --- /dev/null
    +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java
    @@ -0,0 +1,164 @@
    +/*
    + *  Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
    + *  Copyright (c) 2021, Rado Smogura. All rights reserved.
    + *
    + *  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    + *
    + *  This code is free software; you can redistribute it and/or modify it
    + *  under the terms of the GNU General Public License version 2 only, as
    + *  published by the Free Software Foundation.
    + *
    + *  This code is distributed in the hope that it will be useful, but WITHOUT
    + *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    + *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    + *  version 2 for more details (a copy is included in the LICENSE file that
    + *  accompanied this code).
    + *
    + *  You should have received a copy of the GNU General Public License version
    + *  2 along with this work; if not, write to the Free Software Foundation,
    + *  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    + *
    + *  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    + *  or visit www.oracle.com if you need additional information or have any
    + *  questions.
    + *
    + */
    +package org.openjdk.bench.jdk.incubator.vector;
    +
    +import java.lang.foreign.MemorySegment;
    +import java.lang.foreign.MemorySession;
    +import java.nio.ByteOrder;
    +import java.util.concurrent.TimeUnit;
    +import jdk.incubator.vector.ByteVector;
    +import jdk.incubator.vector.VectorSpecies;
    +import org.openjdk.jmh.annotations.Benchmark;
    +import org.openjdk.jmh.annotations.BenchmarkMode;
    +import org.openjdk.jmh.annotations.CompilerControl;
    +import org.openjdk.jmh.annotations.Fork;
    +import org.openjdk.jmh.annotations.Measurement;
    +import org.openjdk.jmh.annotations.Mode;
    +import org.openjdk.jmh.annotations.OutputTimeUnit;
    +import org.openjdk.jmh.annotations.Param;
    +import org.openjdk.jmh.annotations.Setup;
    +import org.openjdk.jmh.annotations.State;
    +import org.openjdk.jmh.annotations.Warmup;
    +
    +@BenchmarkMode(Mode.AverageTime)
    +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
    +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
    +@State(org.openjdk.jmh.annotations.Scope.Benchmark)
    +@OutputTimeUnit(TimeUnit.NANOSECONDS)
    +@Fork(value = 1, jvmArgsAppend = {
    +    "--add-modules=jdk.incubator.vector",
    +    "--enable-preview",
    +    "--enable-native-access", "ALL-UNNAMED"})
    +public class MemorySegmentVectorAccess {
    +  private static final VectorSpecies SPECIES = VectorSpecies.ofLargestShape(byte.class);
    +
    +  @Param("1024")
    +  private int size;
    +
    +  byte[] byteIn;
    +  byte[] byteOut;
    +
    +  MemorySegment nativeIn, nativeOut;
    +  MemorySegment heapIn, heapOut;
    +
    +  MemorySegment nativeInRo, nativeOutRo;
    +  MemorySegment heapInRo, heapOutRo;
    +
    +  @Setup
    +  public void setup() {
    +    nativeIn = MemorySegment.allocateNative(size, MemorySession.openImplicit());
    +    nativeOut = MemorySegment.allocateNative(size, MemorySession.openImplicit());
    +
    +    byteIn = new byte[size];
    +    byteOut = new byte[size];
    +
    +    heapIn = MemorySegment.ofArray(byteIn);
    +    heapOut = MemorySegment.ofArray(byteOut);
    +
    +    nativeInRo = nativeIn.asReadOnly();
    +    nativeOutRo = nativeOut.asReadOnly();
    +
    +    heapInRo = heapIn.asReadOnly();
    +    heapOutRo = heapOut.asReadOnly();
    +  }
    +
    +  @Benchmark
    +  public void directSegments() {
    +    copyMemory(nativeIn, nativeOut);
    +  }
    +
    +  @Benchmark
    +  public void heapSegments() {
    +    copyMemory(heapIn, heapOut);
    +  }
    +
    +  @Benchmark
    +  public void pollutedSegments2() {
    +    copyIntoNotInlined(nativeIn, nativeOut);
    +    copyIntoNotInlined(heapIn, heapOut);
    +  }
    +
    +  @Benchmark
    +  public void pollutedSegments3() {
    +    copyIntoNotInlined(nativeIn, nativeOut);
    +    copyIntoNotInlined(heapIn, heapOut);
    +
    +    copyIntoNotInlined(nativeInRo, nativeOut);
    +    copyIntoNotInlined(heapInRo, heapOut);
    +  }
    +
    +  @Benchmark
    +  public void pollutedSegments4() {
    +    copyIntoNotInlined(nativeIn, heapOut); // Pollute if unswitch on 2nd param
    +    copyIntoNotInlined(heapIn, heapOut);
    +
    +    copyIntoNotInlined(heapIn, nativeIn); // Pollute if unswitch on 1st param
    +    copyIntoNotInlined(heapIn, nativeOut);
    +  }
    +
    +
    +  boolean readOnlyException;
    +
    +  @Benchmark
    +  public void pollutedSegments5() {
    +    copyIntoNotInlined(nativeIn, heapOut);
    +    copyIntoNotInlined(heapIn, heapOut);
    +
    +    copyIntoNotInlined(heapIn, nativeIn);
    +    copyIntoNotInlined(heapIn, nativeOut);
    +
    +    if (readOnlyException) {
    +      try {
    +        copyIntoNotInlined(heapIn, nativeOutRo);
    +      } catch (Exception ignored) {}
    +      readOnlyException = !readOnlyException;
    +    }
    +  }
    +
    +  @Benchmark
    +  public void arrayCopy() {
    +    byte[] in = byteIn;
    +    byte[] out = byteOut;
    +
    +    for (int i = 0; i < SPECIES.loopBound(in.length); i += SPECIES.vectorByteSize()) {
    +      final var v = ByteVector.fromArray(SPECIES, in, i);
    +      v.intoArray(out, i);
    +    }
    +  }
    +
    +  @CompilerControl(CompilerControl.Mode.DONT_INLINE)
    +  protected void copyIntoNotInlined(MemorySegment in, MemorySegment out) {
    +    copyMemory(in, out);
    +  }
    +
    +  @CompilerControl(CompilerControl.Mode.INLINE)
    +  protected void copyMemory(MemorySegment in, MemorySegment out) {
    +    for (long i = 0; i < SPECIES.loopBound(in.byteSize()); i += SPECIES.vectorByteSize()) {
    +      final var v = ByteVector.fromMemorySegment(SPECIES, in, i, ByteOrder.nativeOrder());
    +      v.intoMemorySegment(out, i, ByteOrder.nativeOrder());
    +    }
    +  }
    +}
    diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/RotateBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/RotateBenchmark.java
    index 9320f3ac776..3628479342a 100644
    --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/RotateBenchmark.java
    +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/RotateBenchmark.java
    @@ -32,6 +32,7 @@ import org.openjdk.jmh.infra.Blackhole;
     
     @OutputTimeUnit(TimeUnit.MILLISECONDS)
     @State(Scope.Thread)
    +@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
     public class RotateBenchmark {
         @Param({"256","512"})
         int size;
    diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreBytes.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreBytes.java
    index 026a354aadd..d28c860ebe0 100644
    --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreBytes.java
    +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreBytes.java
    @@ -23,12 +23,11 @@
      */
     package org.openjdk.bench.jdk.incubator.vector;
     
    -import java.nio.ByteBuffer;
    -import java.nio.ByteOrder;
    -import java.util.concurrent.TimeUnit;
     import java.lang.foreign.MemoryAddress;
     import java.lang.foreign.MemorySegment;
     import java.lang.foreign.MemorySession;
    +import java.nio.ByteOrder;
    +import java.util.concurrent.TimeUnit;
     import jdk.incubator.vector.ByteVector;
     import jdk.incubator.vector.VectorOperators;
     import jdk.incubator.vector.VectorSpecies;
    @@ -53,7 +52,7 @@ import static java.lang.foreign.ValueLayout.JAVA_BYTE;
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     @Fork(value = 1, jvmArgsAppend = {
         "--add-modules=jdk.incubator.vector",
    -    "-Dforeign.restricted=permit",
    +    "--enable-preview",
         "--enable-native-access", "ALL-UNNAMED",
         "-Djdk.incubator.vector.VECTOR_ACCESS_OOB_CHECK=1"})
     public class TestLoadStoreBytes {
    @@ -67,31 +66,23 @@ public class TestLoadStoreBytes {
       private byte[] dstArray;
     
     
    -  private ByteBuffer srcBufferHeap;
    +  private MemorySegment srcSegmentHeap;
     
    -  private ByteBuffer dstBufferHeap;
    -
    -  private ByteBuffer srcBufferNative;
    -
    -  private ByteBuffer dstBufferNative;
    +  private MemorySegment dstSegmentHeap;
     
     
       private MemorySession implicitScope;
     
    -  private MemorySegment srcSegmentImplicit;
    +  private MemorySegment srcSegment;
     
    -  private MemorySegment dstSegmentImplicit;
    -
    -  private ByteBuffer srcBufferSegmentImplicit;
    -
    -  private ByteBuffer dstBufferSegmentImplicit;
    +  private MemorySegment dstSegment;
     
     
       private MemoryAddress srcAddress;
     
       private MemoryAddress dstAddress;
     
    -  byte[] a, b, c;
    +  private byte[] a, b, c;
     
       @Setup
       public void setup() {
    @@ -101,23 +92,15 @@ public class TestLoadStoreBytes {
           srcArray[i] = (byte) i;
         }
     
    -
    -    srcBufferHeap = ByteBuffer.allocate(size);
    -    dstBufferHeap = ByteBuffer.allocate(size);
    -
    -    srcBufferNative = ByteBuffer.allocateDirect(size);
    -    dstBufferNative = ByteBuffer.allocateDirect(size);
    -
    +    srcSegmentHeap = MemorySegment.ofArray(new byte[size]);
    +    dstSegmentHeap = MemorySegment.ofArray(new byte[size]);
     
         implicitScope = MemorySession.openImplicit();
    -    srcSegmentImplicit = MemorySegment.allocateNative(size, SPECIES.vectorByteSize(), implicitScope);
    -    srcBufferSegmentImplicit = srcSegmentImplicit.asByteBuffer();
    -    dstSegmentImplicit = MemorySegment.allocateNative(size, SPECIES.vectorByteSize(), implicitScope);
    -    dstBufferSegmentImplicit = dstSegmentImplicit.asByteBuffer();
    +    srcSegment = MemorySegment.allocateNative(size, SPECIES.vectorByteSize(), implicitScope);
    +    dstSegment = MemorySegment.allocateNative(size, SPECIES.vectorByteSize(), implicitScope);
     
    -
    -    srcAddress = MemorySegment.allocateNative(size, implicitScope).address();
    -    dstAddress = MemorySegment.allocateNative(size, implicitScope).address();
    +    srcAddress = srcSegment.address();
    +    dstAddress = dstSegment.address();
     
         a = new byte[size];
         b = new byte[size];
    @@ -127,22 +110,12 @@ public class TestLoadStoreBytes {
     
       @Benchmark
       public void array() {
    -//    final var srcArray = this.srcArray;
         for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
           var v = ByteVector.fromArray(SPECIES, srcArray, i);
           v.intoArray(dstArray, i);
         }
       }
     
    -  @Benchmark
    -  public void array2() {
    -//    final var srcArray = this.srcArray;
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    -      var v = ByteVector.fromByteArray(SPECIES, srcArray, i, ByteOrder.nativeOrder());
    -      v.intoByteArray(dstArray, i, ByteOrder.nativeOrder());
    -    }
    -  }
    -
       @Benchmark
       public void arrayScalar() {
         for (int i = 0; i < SPECIES.loopBound(srcArray.length); i ++) {
    @@ -187,65 +160,30 @@ public class TestLoadStoreBytes {
       }
     
       @Benchmark
    -  public void bufferHeap() {
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    -      var v = ByteVector.fromByteBuffer(SPECIES, srcBufferHeap, i, ByteOrder.nativeOrder());
    -      v.intoByteBuffer(dstBufferHeap, i, ByteOrder.nativeOrder());
    +  public void segmentHeap() {
    +    for (long i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    +      var v = ByteVector.fromMemorySegment(SPECIES, srcSegmentHeap, i, ByteOrder.nativeOrder());
    +      v.intoMemorySegment(dstSegmentHeap, i, ByteOrder.nativeOrder());
         }
       }
     
       @Benchmark
    -  public void bufferHeapScalar() {
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i++) {
    -      var v = srcBufferHeap.get(i);
    -      dstBufferHeap.put(i, v);
    +  public void segmentNativeImplicit() {
    +    for (long i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    +      var v = ByteVector.fromMemorySegment(SPECIES, srcSegment, i, ByteOrder.nativeOrder());
    +      v.intoMemorySegment(dstSegment, i, ByteOrder.nativeOrder());
         }
       }
     
       @Benchmark
    -  @CompilerControl(CompilerControl.Mode.PRINT)
    -  public void bufferNative() {
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    -      var v = ByteVector.fromByteBuffer(SPECIES, srcBufferNative, i, ByteOrder.nativeOrder());
    -      v.intoByteBuffer(dstBufferNative, i, ByteOrder.nativeOrder());
    -    }
    -  }
    +  public void segmentNativeConfined() {
    +    try (final var session = MemorySession.openConfined()) {
    +      final var srcSegmentConfined = MemorySegment.ofAddress(srcAddress, size, session);
    +      final var dstSegmentConfined = MemorySegment.ofAddress(dstAddress, size, session);
     
    -  @Benchmark
    -  public void bufferNativeScalar() {
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i++) {
    -      var v = srcBufferNative.get(i);
    -      dstBufferNative.put(i, v);
    -    }
    -  }
    -
    -
    -  @Benchmark
    -  public void bufferSegmentImplicit() {
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    -      var v = ByteVector.fromByteBuffer(SPECIES, srcBufferSegmentImplicit, i, ByteOrder.nativeOrder());
    -      v.intoByteBuffer(dstBufferSegmentImplicit, i, ByteOrder.nativeOrder());
    -    }
    -  }
    -
    -  @Benchmark
    -  @CompilerControl(CompilerControl.Mode.PRINT)
    -  public void segmentImplicitScalar() {
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i++) {
    -      var v = srcSegmentImplicit.get(JAVA_BYTE, i);
    -      dstSegmentImplicit.set(JAVA_BYTE, i, v);
    -    }
    -  }
    -
    -  @Benchmark
    -  public void bufferSegmentConfined() {
    -    try (final var scope = MemorySession.openConfined()) {
    -      final var srcBufferSegmentConfined = MemorySegment.ofAddress(srcAddress, size, scope).asByteBuffer();
    -      final var dstBufferSegmentConfined = MemorySegment.ofAddress(dstAddress, size, scope).asByteBuffer();
    -
    -      for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    -        var v = ByteVector.fromByteBuffer(SPECIES, srcBufferSegmentConfined, i, ByteOrder.nativeOrder());
    -        v.intoByteBuffer(dstBufferSegmentConfined, i, ByteOrder.nativeOrder());
    +      for (long i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    +        var v = ByteVector.fromMemorySegment(SPECIES, srcSegmentConfined, i, ByteOrder.nativeOrder());
    +        v.intoMemorySegment(dstSegmentConfined, i, ByteOrder.nativeOrder());
           }
         }
       }
    diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShort.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShorts.java
    similarity index 58%
    rename from test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShort.java
    rename to test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShorts.java
    index 8cb83815a7c..ef6f2bb4ed4 100644
    --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShort.java
    +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShorts.java
    @@ -23,7 +23,6 @@
      */
     package org.openjdk.bench.jdk.incubator.vector;
     
    -import java.nio.ByteBuffer;
     import java.nio.ByteOrder;
     import java.util.concurrent.TimeUnit;
     
    @@ -53,9 +52,9 @@ import org.openjdk.jmh.annotations.Warmup;
     @OutputTimeUnit(TimeUnit.NANOSECONDS)
     @Fork(value = 1, jvmArgsAppend = {
         "--add-modules=jdk.incubator.vector",
    -    "-Dforeign.restricted=permit",
    +    "--enable-preview",
         "--enable-native-access", "ALL-UNNAMED"})
    -public class TestLoadStoreShort {
    +public class TestLoadStoreShorts {
       private static final VectorSpecies SPECIES = VectorSpecies.ofLargestShape(short.class);
     
       @Param("256")
    @@ -68,33 +67,24 @@ public class TestLoadStoreShort {
       private short[] dstArray;
     
     
    -  private ByteBuffer srcBufferHeap;
    +  private MemorySegment srcSegmentHeap;
     
    -  private ByteBuffer dstBufferHeap;
    -
    -  private ByteBuffer srcBufferNative;
    -
    -  private ByteBuffer dstBufferNative;
    +  private MemorySegment dstSegmentHeap;
     
     
       private MemorySession implicitScope;
     
    -  private MemorySegment srcSegmentImplicit;
    +  private MemorySegment srcSegment;
     
    -  private MemorySegment dstSegmentImplicit;
    -
    -  private ByteBuffer srcBufferSegmentImplicit;
    -
    -  private ByteBuffer dstBufferSegmentImplicit;
    +  private MemorySegment dstSegment;
     
     
       private MemoryAddress srcAddress;
     
       private MemoryAddress dstAddress;
     
    -//  private byte[] bigArray = new byte[Integer.MAX_VALUE];
    +  private short[] a, b, c;
     
    -  private volatile short[] a, b, c;
       @Setup
       public void setup() {
         var longSize = size / Short.BYTES;
    @@ -104,34 +94,24 @@ public class TestLoadStoreShort {
           srcArray[i] = (short) i;
         }
     
    +    srcSegmentHeap = MemorySegment.ofArray(new byte[size]);
    +    dstSegmentHeap = MemorySegment.ofArray(new byte[size]);
     
    -    srcBufferHeap = ByteBuffer.allocate(size);
    -    dstBufferHeap = ByteBuffer.allocate(size);
    +    implicitScope = MemorySession.openImplicit();
    +    srcSegment = MemorySegment.allocateNative(size, SPECIES.vectorByteSize(), implicitScope);
    +    dstSegment = MemorySegment.allocateNative(size, SPECIES.vectorByteSize(), implicitScope);
     
    -    srcBufferNative = ByteBuffer.allocateDirect(size);
    -    dstBufferNative = ByteBuffer.allocateDirect(size);
    -
    -
    -    implicitScope = MemorySession.openShared();
    -    srcSegmentImplicit = MemorySegment.allocateNative(size, SPECIES.vectorByteSize(), implicitScope);
    -    srcBufferSegmentImplicit = srcSegmentImplicit.asByteBuffer();
    -    dstSegmentImplicit = MemorySegment.allocateNative(size, SPECIES.vectorByteSize(), implicitScope);
    -    dstBufferSegmentImplicit = dstSegmentImplicit.asByteBuffer();
    -
    -
    -    srcAddress = MemorySegment.allocateNative(size, implicitScope).address();
    -    dstAddress = MemorySegment.allocateNative(size, implicitScope).address();
    +    srcAddress = srcSegment.address();
    +    dstAddress = dstSegment.address();
     
         this.longSize = longSize;
     
         a = new short[size];
         b = new short[size];
         c = new short[size];
    -
       }
     
       @Benchmark
    -  @CompilerControl(CompilerControl.Mode.PRINT)
       public void array() {
         for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
           var v = ShortVector.fromArray(SPECIES, srcArray, i);
    @@ -175,47 +155,30 @@ public class TestLoadStoreShort {
       }
     
       @Benchmark
    -  public void bufferHeap() {
    -    for (int i = 0; i < SPECIES.loopBound(longSize); i += SPECIES.length()) {
    -      var v = ShortVector.fromByteBuffer(SPECIES, srcBufferHeap, i, ByteOrder.nativeOrder());
    -      v.intoByteBuffer(dstBufferHeap, i, ByteOrder.nativeOrder());
    +  public void heapSegment() {
    +    for (long i = 0; i < SPECIES.loopBound(longSize); i += SPECIES.length()) {
    +      var v = ShortVector.fromMemorySegment(SPECIES, srcSegmentHeap, i, ByteOrder.nativeOrder());
    +      v.intoMemorySegment(dstSegmentHeap, i, ByteOrder.nativeOrder());
         }
       }
     
       @Benchmark
    -  public void bufferNative() {
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    -      var v = ShortVector.fromByteBuffer(SPECIES, srcBufferNative, i, ByteOrder.nativeOrder());
    -      v.intoByteBuffer(dstBufferNative, i, ByteOrder.nativeOrder());
    +  public void segmentNativeImplicit() {
    +    for (long i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    +      var v = ShortVector.fromMemorySegment(SPECIES, srcSegment, i, ByteOrder.nativeOrder());
    +      v.intoMemorySegment(dstSegment, i, ByteOrder.nativeOrder());
         }
       }
     
       @Benchmark
    -  public void bufferNativeAdd() {
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    -      var v = ShortVector.fromByteBuffer(SPECIES, srcBufferNative, i, ByteOrder.nativeOrder());
    -      v = v.add(v);
    -      v.intoByteBuffer(dstBufferNative, i, ByteOrder.nativeOrder());
    -    }
    -  }
    +  public void segmentNativeConfined() {
    +    try (final var session = MemorySession.openConfined()) {
    +      final var srcSegmentConfined = MemorySegment.ofAddress(srcAddress, size, session);
    +      final var dstSegmentConfined = MemorySegment.ofAddress(dstAddress, size, session);
     
    -  @Benchmark
    -  public void bufferSegmentImplicit() {
    -    for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    -      var v = ShortVector.fromByteBuffer(SPECIES, srcBufferSegmentImplicit, i, ByteOrder.nativeOrder());
    -      v.intoByteBuffer(dstBufferSegmentImplicit, i, ByteOrder.nativeOrder());
    -    }
    -  }
    -
    -  @Benchmark
    -  public void bufferSegmentConfined() {
    -    try (final var scope = MemorySession.openConfined()) {
    -      final var srcBufferSegmentConfined = MemorySegment.ofAddress(srcAddress, size, scope).asByteBuffer();
    -      final var dstBufferSegmentConfined = MemorySegment.ofAddress(dstAddress, size, scope).asByteBuffer();
    -
    -      for (int i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    -        var v = ShortVector.fromByteBuffer(SPECIES, srcBufferSegmentConfined, i, ByteOrder.nativeOrder());
    -        v.intoByteBuffer(dstBufferSegmentConfined, i, ByteOrder.nativeOrder());
    +      for (long i = 0; i < SPECIES.loopBound(srcArray.length); i += SPECIES.length()) {
    +        var v = ShortVector.fromMemorySegment(SPECIES, srcSegmentConfined, i, ByteOrder.nativeOrder());
    +        v.intoMemorySegment(dstSegmentConfined, i, ByteOrder.nativeOrder());
           }
         }
       }