On Thu, 24 Sep 2026 07:06:07 GMT, Jatin Bhateja <[email protected]> wrote:
> Hi All, > > COMPRESS_BITS and EXPAND_BITS advertise compatibility with all integral lane > types, but ByteVector/ShortVector had no implementation and threw > UnsupportedOperationException. > > This patch extends COMPRESS_BITS and EXPAND_BITS to the sub-word integral > types byte and short, covering all integral types. > > The changes encompass: > - Java-side fallback handling for ByteVector and ShortVector. > - Inline expander side changes. > - C2/VectorSupport type plumbing for T_BYTE/T_SHORT. > - Classifying CompressBits/ExpandBits as non-truncating in SuperWord so > subword stores of Integer.compress do not crash debug builds. > - Extending Vector API jtreg tests to cover byte and short COMPRESS_BITS and > EXPAND_BITS. > > Please review and share your feedback. > > Best Regards, > Jatin > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template line 1182: > 1180: v0.bOp(v1, vm, (i, a, n) -> > ($fallbacktype$)Integer.compress(a & LSHR_SETUP_MASK, n & LSHR_SETUP_MASK)); > 1181: case VECTOR_OP_EXPAND_BITS: return (v0, v1, vm) -> > 1182: v0.bOp(v1, vm, (i, a, n) -> > ($fallbacktype$)Integer.expand(a & LSHR_SETUP_MASK, n & LSHR_SETUP_MASK)); Since `LSHR_SETUP_MASK` is now used in a different context we should rename it? e.g. `ALL_BITS_MASK`? test/jdk/jdk/incubator/vector/gen-template.sh line 450: > 448: gen_binary_alu_op "XOR" "a ^ b" "BITWISE" > 449: gen_binary_alu_op "COMPRESS_BITS" "{#if[byteOrShort]?Integer.compress(a > \& ((1 << \$Boxtype\$.SIZE) - 1), b \& ((1 << \$Boxtype\$.SIZE) - > 1)):\$Boxtype\$.compress(a, b)}" "BITWISE" > 450: gen_binary_alu_op "EXPAND_BITS" "{#if[byteOrShort]?Integer.expand(a \& > ((1 << \$Boxtype\$.SIZE) - 1), b \& ((1 << \$Boxtype\$.SIZE) - > 1)):\$Boxtype\$.expand(a, b)}" "BITWISE" Instead of such embedded expressions you can add compress/expand to the relevant test class? Then the conditional is only whether the qualifying class is declared or not. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/33050#discussion_r4097730228 PR Review Comment: https://git.openjdk.org/jdk/pull/33050#discussion_r4097614528
