RFR: 8361582: AArch64: Some ConH values cannot be replicated with SVE [v7]

Jatin Bhateja jbhateja at openjdk.org
Thu Aug 21 07:54:56 UTC 2025


On Fri, 15 Aug 2025 11:54:59 GMT, Bhavana Kilambi <bkilambi at openjdk.org> wrote:

>> After this commit - https://github.com/openjdk/jdk/commit/a49ecb26c5ff2f949851937f3bb036d7946a103e, the JTREG test -
>> `test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorOperations.java` fails for some of the tests which contain constant values such as -
>> 
>> 
>> public void vectorAddConstInputFloat16() {
>>          for (int i = 0; i < LEN; ++i) {
>>              output[i] = float16ToRawShortBits(add(shortBitsToFloat16(input1[i]), FP16_CONST));
>>          }
>>      }
>> 
>> 
>> 
>> <The full failure log is present in the JBS ticket, thus not reproducing it here>
>> 
>> The current code in the JDK results in the generation of sve_dup instruction for every 16-bit immediate while the acceptable range is [-128, 127] for 8-bit immediates and [-127 << 8, 128 << 8] with a multiple of 256 for 16-bit signed immediates.
>> 
>> This patch allows the generation of sve_dup instruction for only those 16-bit values which are within the limits as specified above and for the values which are out of range, the immediate half float value is loaded from the constant pool into a register ("loadConH" mach node) which is then replicated or broadcasted to an SVE register ("replicateHF" mach node).
>> 
>> Both the tests - `test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorOperations.java` and `test/hotspot/jtreg/compiler/c2/aarch64/TestFloat16Replicate.java` pass on 256-bit SVE machine. JTREG tests - hotspot (hotspot_all), langtools (tier1) and jdk(tier 1-3) pass on the same machine.
>
> Bhavana Kilambi has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Addressed review comments

test/hotspot/jtreg/compiler/c2/aarch64/TestFloat16Replicate.java line 66:

> 64:             input[i] = (short) i;
> 65:         }
> 66:     }

How about using Generators for initialization?

test/hotspot/jtreg/compiler/c2/aarch64/TestFloat16Replicate.java line 91:

> 89:             if (expected != output[i]) {
> 90:                 throw new AssertionError("Result Mismatch!, input = " + input[i] + " constant = " + FP16_IN_RANGE + " actual = " + output[i] +  " expected = " + expected);
> 91:             }

Prefer using Verify.check*
https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/compiler/lib/verify/Verify.java

test/hotspot/jtreg/compiler/c2/aarch64/TestFloat16Replicate.java line 121:

> 119:             if (expected != output[i]) {
> 120:                 throw new AssertionError("Result Mismatch!, input = " + input[i] + " constant = " + FP16_OUT_OF_RANGE + " actual = " + output[i] +  " expected = " + expected);
> 121:             }

As above, please use Verify.check* API.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26589#discussion_r2290195499
PR Review Comment: https://git.openjdk.org/jdk/pull/26589#discussion_r2290190431
PR Review Comment: https://git.openjdk.org/jdk/pull/26589#discussion_r2290192173


More information about the hotspot-compiler-dev mailing list