1
1
/*
2
2
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
3
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
5
*
5
6
* This code is free software; you can redistribute it and/or modify it
46
47
public class ArrayIndexFillTest extends VectorizationTestRunner {
47
48
48
49
private static final int SIZE = 543 ;
50
+ private static int init = 0 ;
51
+ private static int limit = SIZE ;
49
52
50
53
private int [] a ;
51
54
@@ -101,6 +104,11 @@ public int[] fillIntArray() {
101
104
}
102
105
103
106
@ 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
104
112
public long [] fillLongArray () {
105
113
long [] res = new long [SIZE ];
106
114
for (int i = 0 ; i < SIZE ; i ++) {
@@ -109,6 +117,65 @@ public long[] fillLongArray() {
109
117
return res ;
110
118
}
111
119
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
+
112
179
@ Test
113
180
@ IR (applyIfCPUFeatureOr = {"sve" , "true" , "avx2" , "true" },
114
181
counts = {IRNode .POPULATE_INDEX , ">0" })
0 commit comments