1# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15.class public LArraySet;
16.super Ljava/lang/Object;
17
18# Test ArraySet on int[] and float[] arrays. The input should be typed accordingly.
19# Note that the input is a Phi to make sure primitive type propagation is re-run
20# on the replaced inputs.
21
22## CHECK-START: void ArraySet.ambiguousSet(int[], float[], boolean) builder (after)
23## CHECK-DAG:     <<IntArray:l\d+>>    ParameterValue klass:int[]
24## CHECK-DAG:     <<IntA:i\d+>>        IntConstant 0
25## CHECK-DAG:     <<IntB:i\d+>>        IntConstant 1073741824
26## CHECK-DAG:     <<IntPhi:i\d+>>      Phi [<<IntA>>,<<IntB>>] reg:0
27## CHECK-DAG:     <<IntNC:l\d+>>       NullCheck [<<IntArray>>]
28## CHECK-DAG:                          ArraySet [<<IntNC>>,{{i\d+}},<<IntPhi>>]
29
30## CHECK-DAG:     <<FloatArray:l\d+>>  ParameterValue klass:float[]
31## CHECK-DAG:     <<FloatA:f\d+>>      FloatConstant 0
32## CHECK-DAG:     <<FloatB:f\d+>>      FloatConstant 2
33## CHECK-DAG:     <<FloatPhi:f\d+>>    Phi [<<FloatA>>,<<FloatB>>] reg:0
34## CHECK-DAG:     <<FloatNC:l\d+>>     NullCheck [<<FloatArray>>]
35## CHECK-DAG:                          ArraySet [<<FloatNC>>,{{i\d+}},<<FloatPhi>>]
36
37.method public static ambiguousSet([I[FZ)V
38  .registers 8
39
40  const v0, 0x0
41  if-eqz p2, :else
42  const v0, 0x40000000
43  :else
44  # v0 = Phi [0.0f, 2.0f]
45
46  const v1, 0x1
47  aput v0, p0, v1
48  aput v0, p1, v1
49
50  return-void
51.end method
52