11/*
22 * Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
3+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
34 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45 *
56 * This code is free software; you can redistribute it and/or modify it
4647public class ArrayIndexFillTest extends VectorizationTestRunner {
4748
4849 private static final int SIZE = 543 ;
50+ private static int init = 0 ;
51+ private static int limit = SIZE ;
4952
5053 private int [] a ;
5154
@@ -101,6 +104,11 @@ public int[] fillIntArray() {
101104 }
102105
103106 @ Test
107+ @ IR (applyIfCPUFeatureOr = {"sve" , "true" , "avx2" , "true" },
108+ counts = {IRNode .POPULATE_INDEX , "=0" })
109+ // The ConvI2L can be split through the AddI, creating a mix of
110+ // ConvI2L(AddI) and AddL(ConvI2L) cases, which do not vectorize.
111+ // See: JDK-8332878
104112 public long [] fillLongArray () {
105113 long [] res = new long [SIZE ];
106114 for (int i = 0 ; i < SIZE ; i ++) {
@@ -109,6 +117,65 @@ public long[] fillLongArray() {
109117 return res ;
110118 }
111119
120+ @ Test
121+ @ IR (applyIfCPUFeatureOr = {"sve" , "true" , "avx2" , "true" },
122+ counts = {IRNode .POPULATE_INDEX , ">0" })
123+ // The variable init/limit has the consequence that we do not split
124+ // the ConvI2L through the AddI.
125+ public long [] fillLongArray2 () {
126+ long [] res = new long [SIZE ];
127+ for (int i = init ; i < limit ; i ++) {
128+ res [i ] = i ;
129+ }
130+ return res ;
131+ }
132+
133+ @ Test
134+ @ IR (applyIfCPUFeatureOr = {"sve" , "true" , "avx2" , "true" },
135+ counts = {IRNode .POPULATE_INDEX , "=0" })
136+ // See: JDK-8332878
137+ public float [] fillFloatArray () {
138+ float [] res = new float [SIZE ];
139+ for (int i = 0 ; i < SIZE ; i ++) {
140+ res [i ] = i ;
141+ }
142+ return res ;
143+ }
144+
145+ @ Test
146+ @ IR (applyIfCPUFeatureOr = {"sve" , "true" , "avx2" , "true" },
147+ counts = {IRNode .POPULATE_INDEX , ">0" })
148+ public float [] fillFloatArray2 () {
149+ float [] res = new float [SIZE ];
150+ for (int i = init ; i < limit ; i ++) {
151+ res [i ] = i ;
152+ }
153+ return res ;
154+ }
155+
156+ @ Test
157+ @ IR (applyIfCPUFeatureOr = {"sve" , "true" , "avx2" , "true" },
158+ counts = {IRNode .POPULATE_INDEX , "=0" })
159+ // See: JDK-8332878
160+ public double [] fillDoubleArray () {
161+ double [] res = new double [SIZE ];
162+ for (int i = 0 ; i < SIZE ; i ++) {
163+ res [i ] = i ;
164+ }
165+ return res ;
166+ }
167+
168+ @ Test
169+ @ IR (applyIfCPUFeatureOr = {"sve" , "true" , "avx2" , "true" },
170+ counts = {IRNode .POPULATE_INDEX , ">0" })
171+ public double [] fillDoubleArray2 () {
172+ double [] res = new double [SIZE ];
173+ for (int i = init ; i < limit ; i ++) {
174+ res [i ] = i ;
175+ }
176+ return res ;
177+ }
178+
112179 @ Test
113180 @ IR (applyIfCPUFeatureOr = {"sve" , "true" , "avx2" , "true" },
114181 counts = {IRNode .POPULATE_INDEX , ">0" })
0 commit comments