1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 public class Main {
18 
assertIntEquals(int expected, int result)19   public static void assertIntEquals(int expected, int result) {
20     if (expected != result) {
21       throw new Error("Expected: " + expected + ", found: " + result);
22     }
23   }
24 
25   /// CHECK-START-ARM64: void Main.checkIntCase(int[]) instruction_simplifier_arm64 (before)
26   /// CHECK-DAG:             <<Array:l\d+>>         ParameterValue
27   /// CHECK-DAG:             <<Const5:i\d+>>        IntConstant 5
28   /// CHECK-IF:     hasIsaFeature("sve")
29   //
30   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>,{{j\d+}}]
31   //      -------------- Loop
32   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
33   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
34   ///     CHECK-DAG:                                    If
35   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Index>>,<<LoopP>>]
36   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>,<<LoopP>>]
37   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Add>>,<<LoopP>>]
38   //
39   /// CHECK-ELSE:
40   //
41   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>]
42   //      -------------- Loop
43   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
44   ///     CHECK-DAG:                                    If
45   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Index>>]
46   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>]
47   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Add>>]
48   //
49   /// CHECK-FI:
50 
51   /// CHECK-START-ARM64: void Main.checkIntCase(int[]) instruction_simplifier_arm64 (after)
52   /// CHECK-DAG:             <<Array:l\d+>>         ParameterValue
53   /// CHECK-DAG:             <<Const5:i\d+>>        IntConstant 5
54   /// CHECK-IF:     hasIsaFeature("sve")
55   //
56   //      IntermediateAddressIndex is not supported for SVE.
57   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>,{{j\d+}}]
58   //      -------------- Loop
59   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
60   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
61   ///     CHECK-DAG:                                    If
62   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Index>>,<<LoopP>>]
63   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>,<<LoopP>>]
64   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Add>>,<<LoopP>>]
65   //
66   /// CHECK-ELSE:
67   //
68   ///     CHECK-DAG:             <<Const2:i\d+>>        IntConstant 2
69   ///     CHECK-DAG:             <<DataOffset:i\d+>>    IntConstant 12
70   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>]
71   //      -------------- Loop
72   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
73   ///     CHECK-DAG:                                    If
74   ///     CHECK-DAG:             <<Address1:i\d+>>      IntermediateAddressIndex [<<Index>>,<<DataOffset>>,<<Const2>>]
75   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Address1>>]
76   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>]
77   ///     CHECK-DAG:             <<Address2:i\d+>>      IntermediateAddressIndex [<<Index>>,<<DataOffset>>,<<Const2>>]
78   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Address2>>,<<Add>>]
79   //
80   /// CHECK-FI:
81 
82   /// CHECK-START-ARM64: void Main.checkIntCase(int[]) GVN$after_arch (after)
83   /// CHECK-DAG:             <<Array:l\d+>>         ParameterValue
84   /// CHECK-DAG:             <<Const5:i\d+>>        IntConstant 5
85   /// CHECK-IF:     hasIsaFeature("sve")
86   //
87   //      IntermediateAddressIndex is not supported for SVE.
88   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>,{{j\d+}}]
89   //      -------------- Loop
90   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
91   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
92   ///     CHECK-DAG:                                    If
93   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Index>>,<<LoopP>>]
94   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>,<<LoopP>>]
95   ///     CHECK-NOT:                                    IntermediateAddress
96   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Add>>,<<LoopP>>]
97   //
98   /// CHECK-ELSE:
99   //
100   ///     CHECK-DAG:             <<DataOffset:i\d+>>    IntConstant 12
101   ///     CHECK-DAG:             <<Const2:i\d+>>        IntConstant 2
102   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>]
103   //      -------------- Loop
104   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
105   ///     CHECK-DAG:                                    If
106   ///     CHECK-DAG:             <<Address1:i\d+>>      IntermediateAddressIndex [<<Index>>,<<DataOffset>>,<<Const2>>]
107   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Address1>>]
108   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>]
109   ///     CHECK-NOT:                                    IntermediateAddress
110   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Address1>>,<<Add>>]
111   //
112   /// CHECK-FI:
113 
114   /// CHECK-START-ARM64: void Main.checkIntCase(int[]) disassembly (after)
115   /// CHECK-IF:     hasIsaFeature("sve")
116   //
117   //      IntermediateAddressIndex is not supported for SVE.
118   ///     CHECK-NOT:                                    IntermediateAddressIndex
119   ///     CHECK-NOT:                                    IntermediateAddress
120   //
121   /// CHECK-ELSE:
122   //
123   ///     CHECK:                                        IntermediateAddressIndex
124   ///     CHECK-NEXT:                                   add w{{[0-9]+}}, w{{[0-9]+}}, w{{[0-9]+}}, lsl #2
125   //
126   /// CHECK-FI:
checkIntCase(int[] a)127   public static void checkIntCase(int[] a) {
128     for (int i = 0; i < 128; i++) {
129       a[i] += 5;
130     }
131   }
132 
133   /// CHECK-START-ARM64: void Main.checkByteCase(byte[]) instruction_simplifier_arm64 (before)
134   /// CHECK-DAG:             <<Array:l\d+>>         ParameterValue
135   /// CHECK-DAG:             <<Const5:i\d+>>        IntConstant 5
136   /// CHECK-IF:     hasIsaFeature("sve")
137   //
138   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>,{{j\d+}}]
139   //      -------------- Loop
140   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
141   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
142   ///     CHECK-DAG:                                    If
143   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Index>>,<<LoopP>>]
144   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>,<<LoopP>>]
145   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Add>>,<<LoopP>>]
146   //
147   /// CHECK-ELSE:
148   //
149   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>]
150   //      -------------- Loop
151   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
152   ///     CHECK-DAG:                                    If
153   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Index>>]
154   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>]
155 
156   //
157   /// CHECK-FI:
158 
159   /// CHECK-START-ARM64: void Main.checkByteCase(byte[]) instruction_simplifier_arm64 (after)
160   /// CHECK-DAG:             <<Array:l\d+>>         ParameterValue
161   /// CHECK-DAG:             <<Const0:i\d+>>        IntConstant 0
162   /// CHECK-DAG:             <<Const5:i\d+>>        IntConstant 5
163   /// CHECK-IF:     hasIsaFeature("sve")
164   //
165   //      IntermediateAddressIndex is not supported for SVE.
166   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>,{{j\d+}}]
167   //      -------------- Loop
168   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
169   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
170   ///     CHECK-DAG:                                    If
171   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Index>>,<<LoopP>>]
172   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>,<<LoopP>>]
173   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Add>>,<<LoopP>>]
174   //
175   /// CHECK-ELSE:
176   //
177   ///     CHECK-DAG:             <<DataOffset:i\d+>>    IntConstant 12
178   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>]
179   //      -------------- Loop
180   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
181   ///     CHECK-DAG:                                    If
182   ///     CHECK-DAG:             <<Address1:i\d+>>      IntermediateAddressIndex [<<Index>>,<<DataOffset>>,<<Const0>>]
183   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Address1>>]
184   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>]
185   ///     CHECK-DAG:             <<Address2:i\d+>>      IntermediateAddressIndex [<<Index>>,<<DataOffset>>,<<Const0>>]
186   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Address2>>,<<Add>>]
187   //
188   /// CHECK-FI:
189 
190   /// CHECK-START-ARM64: void Main.checkByteCase(byte[]) GVN$after_arch (after)
191   /// CHECK-DAG:             <<Array:l\d+>>         ParameterValue
192   /// CHECK-DAG:             <<Const0:i\d+>>        IntConstant 0
193   /// CHECK-DAG:             <<Const5:i\d+>>        IntConstant 5
194   /// CHECK-IF:     hasIsaFeature("sve")
195   //
196   //      IntermediateAddressIndex is not supported for SVE.
197   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>,{{j\d+}}]
198   //      -------------- Loop
199   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
200   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
201   ///     CHECK-DAG:                                    If
202   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Index>>,<<LoopP>>]
203   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>,<<LoopP>>]
204   ///     CHECK-NOT:                                    IntermediateAddress
205   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Add>>,<<LoopP>>]
206   //
207   /// CHECK-ELSE:
208   //
209   ///     CHECK-DAG:             <<DataOffset:i\d+>>    IntConstant 12
210   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>]
211   //      -------------- Loop
212   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
213   ///     CHECK-DAG:                                    If
214   ///     CHECK-DAG:             <<Address1:i\d+>>      IntermediateAddressIndex [<<Index>>,<<DataOffset>>,<<Const0>>]
215   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array>>,<<Address1>>]
216   ///     CHECK-DAG:             <<Add:d\d+>>           VecAdd [<<Load>>,<<Repl>>]
217   ///     CHECK-NOT:                                    IntermediateAddress
218   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Address1>>,<<Add>>]
219   //
220   /// CHECK-FI:
221 
222   /// CHECK-START-ARM64: void Main.checkByteCase(byte[]) disassembly (after)
223   /// CHECK-IF:     hasIsaFeature("sve")
224   //
225   //      IntermediateAddressIndex is not supported for SVE.
226   ///     CHECK-NOT:                                    IntermediateAddressIndex
227   ///     CHECK-NOT:                                    IntermediateAddress
228   //
229   /// CHECK-ELSE:
230   //
231   ///     CHECK:                                        IntermediateAddressIndex
232   ///     CHECK-NEXT:                                   add w{{[0-9]+}}, w{{[0-9]+}}, #0x{{[0-9a-fA-F]+}}
233   ///     CHECK:                                        VecLoad
234   ///     CHECK-NEXT:                                   ldr q{{[0-9]+}}, [x{{[0-9]+}}, x{{[0-9]+}}]
235   ///     CHECK:                                        VecStore
236   ///     CHECK-NEXT:                                   str q{{[0-9]+}}, [x{{[0-9]+}}, x{{[0-9]+}}]
237   //
238   /// CHECK-FI:
checkByteCase(byte[] a)239   public static void checkByteCase(byte[] a) {
240     for (int i = 0; i < 128; i++) {
241       a[i] += 5;
242     }
243   }
244 
245   /// CHECK-START-ARM64: void Main.checkSingleAccess(int[]) instruction_simplifier_arm64 (before)
246   /// CHECK-DAG:             <<Array:l\d+>>         ParameterValue
247   /// CHECK-DAG:             <<Const5:i\d+>>        IntConstant 5
248   /// CHECK-IF:     hasIsaFeature("sve")
249   //
250   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>,{{j\d+}}]
251   //      -------------- Loop
252   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
253   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
254   ///     CHECK-DAG:                                    If
255   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Repl>>,<<LoopP>>]
256   //
257   /// CHECK-ELSE:
258   //
259   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>]
260   //      -------------- Loop
261   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
262   ///     CHECK-DAG:                                    If
263   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Repl>>]
264   //
265   /// CHECK-FI:
266 
267   /// CHECK-START-ARM64: void Main.checkSingleAccess(int[]) instruction_simplifier_arm64 (after)
268   /// CHECK-DAG:             <<Array:l\d+>>         ParameterValue
269   /// CHECK-DAG:             <<Const0:i\d+>>        IntConstant 0
270   /// CHECK-DAG:             <<Const5:i\d+>>        IntConstant 5
271   /// CHECK-IF:     hasIsaFeature("sve")
272   //
273   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>,{{j\d+}}]
274   //      -------------- Loop
275   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
276   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
277   ///     CHECK-DAG:                                    If
278   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Repl>>,<<LoopP>>]
279   //
280   /// CHECK-ELSE:
281   //
282   ///     CHECK-DAG:             <<Repl:d\d+>>          VecReplicateScalar [<<Const5>>]
283   //      -------------- Loop
284   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
285   ///     CHECK-DAG:                                    If
286   ///     CHECK-DAG:                                    VecStore [<<Array>>,<<Index>>,<<Repl>>]
287   //
288   /// CHECK-FI:
289   //
290   /// CHECK-NOT:                                    IntermediateAddress
checkSingleAccess(int[] a)291   public static void checkSingleAccess(int[] a) {
292     for (int i = 0; i < 128; i++) {
293       a[i] = 5;
294     }
295   }
296 
297   /// CHECK-START-ARM64: void Main.checkInt2Float(int[], float[]) instruction_simplifier_arm64 (before)
298   /// CHECK-DAG:             <<Array1:l\d+>>        ParameterValue
299   /// CHECK-DAG:             <<Array2:l\d+>>        ParameterValue
300   //  -------------- Loop
301   /// CHECK-IF:     hasIsaFeature("sve")
302   //
303   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
304   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
305   ///     CHECK-DAG:                                    If
306   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array1>>,<<Index>>,<<LoopP>>]
307   ///     CHECK-DAG:             <<Cnv:d\d+>>           VecCnv [<<Load>>,<<LoopP>>]
308   ///     CHECK-DAG:                                    VecStore [<<Array2>>,<<Index>>,<<Cnv>>,<<LoopP>>]
309   //
310   /// CHECK-ELSE:
311   //
312   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
313   ///     CHECK-DAG:                                    If
314   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array1>>,<<Index>>]
315   ///     CHECK-DAG:             <<Cnv:d\d+>>           VecCnv [<<Load>>]
316   ///     CHECK-DAG:                                    VecStore [<<Array2>>,<<Index>>,<<Cnv>>]
317   //
318   /// CHECK-FI:
319 
320   /// CHECK-START-ARM64: void Main.checkInt2Float(int[], float[]) instruction_simplifier_arm64 (after)
321   /// CHECK-DAG:             <<Array1:l\d+>>        ParameterValue
322   /// CHECK-DAG:             <<Array2:l\d+>>        ParameterValue
323   /// CHECK-IF:     hasIsaFeature("sve")
324   //
325   //      IntermediateAddressIndex is not supported for SVE.
326   //      -------------- Loop
327   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
328   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
329   ///     CHECK-DAG:                                    If
330   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array1>>,<<Index>>,<<LoopP>>]
331   ///     CHECK-DAG:             <<Cnv:d\d+>>           VecCnv [<<Load>>,<<LoopP>>]
332   ///     CHECK-DAG:                                    VecStore [<<Array2>>,<<Index>>,<<Cnv>>,<<LoopP>>]
333   //
334   /// CHECK-ELSE:
335   //
336   ///     CHECK-DAG:             <<DataOffset:i\d+>>    IntConstant 12
337   ///     CHECK-DAG:             <<Const2:i\d+>>        IntConstant 2
338   //      -------------- Loop
339   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
340   ///     CHECK-DAG:                                    If
341   ///     CHECK-DAG:             <<Address1:i\d+>>      IntermediateAddressIndex [<<Index>>,<<DataOffset>>,<<Const2>>]
342   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array1>>,<<Address1>>]
343   ///     CHECK-DAG:             <<Cnv:d\d+>>           VecCnv [<<Load>>]
344   ///     CHECK-DAG:             <<Address2:i\d+>>      IntermediateAddressIndex [<<Index>>,<<DataOffset>>,<<Const2>>]
345   ///     CHECK-DAG:                                    VecStore [<<Array2>>,<<Address2>>,<<Cnv>>]
346   //
347   /// CHECK-FI:
348 
349   /// CHECK-START-ARM64: void Main.checkInt2Float(int[], float[]) GVN$after_arch (after)
350   /// CHECK-DAG:             <<Array1:l\d+>>        ParameterValue
351   /// CHECK-DAG:             <<Array2:l\d+>>        ParameterValue
352   /// CHECK-IF:     hasIsaFeature("sve")
353   //
354   //      IntermediateAddressIndex is not supported for SVE.
355   //      -------------- Loop
356   ///     CHECK-DAG:             <<LoopP:j\d+>>         VecPredWhile
357   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
358   ///     CHECK-DAG:                                    If
359   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array1>>,<<Index>>,<<LoopP>>]
360   ///     CHECK-DAG:             <<Cnv:d\d+>>           VecCnv [<<Load>>,<<LoopP>>]
361   ///     CHECK-NOT:                                    IntermediateAddress
362   ///     CHECK-DAG:                                    VecStore [<<Array2>>,<<Index>>,<<Cnv>>,<<LoopP>>]
363   //
364   /// CHECK-ELSE:
365   //
366   ///     CHECK-DAG:             <<DataOffset:i\d+>>    IntConstant 12
367   ///     CHECK-DAG:             <<Const2:i\d+>>        IntConstant 2
368   //      -------------- Loop
369   ///     CHECK-DAG:             <<Index:i\d+>>         Phi
370   ///     CHECK-DAG:                                    If
371   ///     CHECK-DAG:             <<Address1:i\d+>>      IntermediateAddressIndex [<<Index>>,<<DataOffset>>,<<Const2>>]
372   ///     CHECK-DAG:             <<Load:d\d+>>          VecLoad [<<Array1>>,<<Address1>>]
373   ///     CHECK-DAG:             <<Cnv:d\d+>>           VecCnv [<<Load>>]
374   ///     CHECK-NOT:                                    IntermediateAddress
375   ///     CHECK-DAG:                                    VecStore [<<Array2>>,<<Address1>>,<<Cnv>>]
376   //
377   /// CHECK-FI:
378 
379   /// CHECK-START-ARM64: void Main.checkInt2Float(int[], float[]) disassembly (after)
380   /// CHECK-IF:     hasIsaFeature("sve")
381   //
382   //      IntermediateAddressIndex is not supported for SVE.
383   ///     CHECK-NOT:                                    IntermediateAddressIndex
384   ///     CHECK-NOT:                                    IntermediateAddress
385   //
386   /// CHECK-ELSE:
387   //
388   ///     CHECK:                                        IntermediateAddressIndex
389   ///     CHECK-NEXT:                                   add w{{[0-9]+}}, w{{[0-9]+}}, w{{[0-9]+}}, lsl #2
390   //
391   /// CHECK-FI:
checkInt2Float(int[] a, float[] b)392   public static void checkInt2Float(int[] a, float[] b) {
393     for (int i = 0; i < 128; i++) {
394       b[i] = (float) a[i];
395     }
396   }
397 
398   public static final int ARRAY_SIZE = 1024;
399 
calcArraySum(int[] a, byte[] b, float[] c)400   public static int calcArraySum(int[] a, byte[] b, float[] c) {
401     int sum = 0;
402     for (int i = 0; i < 128; i++) {
403       sum += a[i] + b[i] + (int) c[i];
404     }
405     return sum;
406   }
407 
main(String[] args)408   public static void main(String[] args) {
409     byte[] ba = new byte[ARRAY_SIZE];
410     int[] ia = new int[ARRAY_SIZE];
411     float[] fa = new float[ARRAY_SIZE];
412 
413     checkSingleAccess(ia);
414     checkIntCase(ia);
415     checkByteCase(ba);
416     checkInt2Float(ia, fa);
417 
418     assertIntEquals(3200, calcArraySum(ia, ba, fa));
419   }
420 }
421