[vectorIntrinsics] RFR: 8253680: Vector API VectorMask and VectorSpecies tests for coverage

Paul Sandoz psandoz at openjdk.java.net
Mon Sep 28 18:22:33 UTC 2020


On Fri, 25 Sep 2020 23:22:25 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

> 8253680: Vector API VectorMask and VectorSpecies tests for coverage

Changes requested by psandoz (Committer).

test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template line 424:

> 422:             int expectedTcount = Long.bitCount(vmask.toLong());
> 423: #else[!MaxBit]
> 424:             int expectedTcount = 0;

I think you should consistently derive the expected count from the source `a` regardless of the kind of vector.

test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template line 467:

> 465:         var vmask = VectorMask.fromLong(SPECIES, inputLong);
> 466:         long outputLong = vmask.toLong();
> 467:         Assert.assertEquals(outputLong, inputLong & (((1l << (SPECIES.length()-1)) << 1)-1));

Recommend using `L` for the identifier of a long value (see also array declaration in `longMaskProvider`)
since lower case letter `l` is hard to distinguish from the digit `1`, and placing spaces in the subtracting
expression. Alternatively could use `SPECIES.maskAll(true).toLong()` to avoid a complex expression dealing with the
edge case of 64 lanes.

test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template line 487:

> 485:         for (int i = 0; i < limit; i += SPECIES.length()) {
> 486:             var actualMask = SPECIES.indexInRange(i+offset, limit);
> 487:             var expectedMask = SPECIES.maskAll(true).indexInRange(i+offset, limit);

`i+offset` -> `i + offset` and for other expressions

-------------

PR: https://git.openjdk.java.net/panama-vector/pull/9


More information about the panama-dev mailing list