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

Bhavana Kilambi bkilambi at openjdk.org
Thu Aug 21 09:00:56 UTC 2025


On Thu, 21 Aug 2025 08:55:08 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> That's what I had in my first patch but changed it to a `for` loop after this comment - https://github.com/openjdk/jdk/pull/26589#discussion_r2260403263.
>> I think it doesn't matter in this case. What's more important is the constant value being passed. Otherwise, the `TestFloat16VectorOperations.java` JTREG test does use generators and test this shape for all values of Float16.
>
> Ok, in general its advisable to use Generators for any initialization,  another suggestion, you can also generate constant dynamically through @Stable arrays, here is an example 
> 
> 
> 
> import jdk.internal.vm.annotation.Stable;
> import java.util.concurrent.ThreadLocalRandom;
> 
> public class random_constants {
>     public static final int idx = ThreadLocalRandom.current().nextInt(1034);
> 
>     @Stable
>     public static int [] arr;
> 
>     public static void init() {
>         arr = new int[1024];
>         for (int i = 0; i < 1024; i++) {
>             arr[i] = ThreadLocalRandom.current().nextInt();
>         }
>     }
> 
>     public static int yeild_number() {
>         return arr[idx] + 10;
>     }
> 
>     public static void main(String [] args) {
>         int res = 0;
>         init();
>         for (int i = 0; i < 100000; i++) {
>             res += yeild_number();
>         }
>         System.out.println("[res] " + res);
>     }
> }
> 
> PROMPT>java --add-exports=java.base/jdk.internal.vm.annotation=ALL-UNNAMED -Xbatch -XX:-TieredCompilation -Xbootclasspath/a:. -XX:CompileCommand=PrintIdealPhase,random_constants::yeild_number,BEFORE_MATCHING -cp .  random_constants
> CompileCommand: PrintIdealPhase random_constants.yeild_number const char* PrintIdealPhase = 'BEFORE_MATCHING'
> AFTER: BEFORE_MATCHING
>   0  Root  === 0 32  [[ 0 1 3 31 ]] inner
>   3  Start  === 3 0  [[ 3 5 6 7 8 9 ]]  #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address}
>   5  Parm  === 3  [[ 32 ]] Control !jvms: random_constants::yeild_number @ bci:-1 (line 19)
>   6  Parm  === 3  [[ 32 ]] I_O !jvms: random_constants::yeild_number @ bci:-1 (line 19)
>   7  Parm  === 3  [[ 32 ]] Memory  Memory: @BotPTR *+bot, idx=Bot; !jvms: random_constants::yeild_number @ bci:-1 (line 19)
>   8  Parm  === 3  [[ 32 ]] FramePtr !jvms: random_constants::yeild_number @ bci:-1 (line 19)
>   9  Parm  === 3  [[ 32 ]] ReturnAdr !jvms: random_constants::yeild_number @ bci:-1 (line 19)
>  31  ConI  === 0  [[ 32 ]]  #int:-753356878
>  32  Return  === 5 6 7 8 9 returns 31  [[ 0 ]]
> [res] -1961428160

Thanks for sharing. This looks interesting.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26589#discussion_r2290393597


More information about the hotspot-compiler-dev mailing list