1# Copyright (C) 2017 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.class public LSmali;
15.super Ljava/lang/Object;
16
17##  CHECK-START: void Smali.test3Order1(boolean, int, int, int, int, int) register (after)
18##  CHECK:       name "B0"
19##  CHECK-NOT:     ParallelMove
20##  CHECK:       name "B1"
21##  CHECK-NOT:   end_block
22##  CHECK:         If
23##  CHECK-NOT:     ParallelMove
24##  CHECK:       name "B6"
25##  CHECK-NOT:   end_block
26##  CHECK:         InstanceFieldSet
27#    We could check here that there is a parallel move, but it's only valid
28#    for some architectures (for example x86), as other architectures may
29#    not do move at all.
30##  CHECK:       end_block
31##  CHECK-NOT:     ParallelMove
32.method public static test3Order1(ZIIIII)V
33    .registers 14
34
35    sget v0, LMain;->live1:I
36    sget v1, LMain;->live2:I
37    sget v2, LMain;->live3:I
38    sget v5, LMain;->live0:I
39    if-eqz p0, :cond_13
40
41    sput v0, LMain;->live1:I
42
43    :goto_c
44    add-int v6, v0, v1
45    add-int/2addr v6, v2
46    add-int/2addr v6, v5
47    sput v6, LMain;->live1:I
48
49    return-void
50
51    :cond_13
52    sget-boolean v6, LMain;->y:Z
53
54    if-eqz v6, :cond_1a
55    sput v0, LMain;->live1:I
56    goto :goto_c
57
58    :cond_1a
59    sget v3, LMain;->live4:I
60
61    sget v4, LMain;->live5:I
62    sget-object v6, LMain;->foo:LMain$Foo;
63    add-int v7, v0, v4
64    add-int/2addr v7, v3
65    iput v7, v6, LMain$Foo;->field2:I
66    sget-object v6, LMain;->foo:LMain$Foo;
67    add-int v7, v1, v4
68    add-int/2addr v7, v3
69    iput v7, v6, LMain$Foo;->field3:I
70    sget-object v6, LMain;->foo:LMain$Foo;
71    add-int v7, v2, v4
72    add-int/2addr v7, v3
73    iput v7, v6, LMain$Foo;->field4:I
74    sget-object v6, LMain;->foo:LMain$Foo;
75    iput v3, v6, LMain$Foo;->field0:I
76    sget-object v6, LMain;->foo:LMain$Foo;
77    add-int v7, v4, v3
78    iput v7, v6, LMain$Foo;->field1:I
79    goto :goto_c
80.end method
81
82##  CHECK-START: void Smali.test3Order2(boolean, int, int, int, int, int) register (after)
83##  CHECK:       name "B0"
84##  CHECK-NOT:     ParallelMove
85##  CHECK:       name "B1"
86##  CHECK-NOT:   end_block
87##  CHECK:         If
88##  CHECK-NOT:     ParallelMove
89##  CHECK:       name "B5"
90##  CHECK-NOT:   end_block
91##  CHECK:         InstanceFieldSet
92#    We could check here that there is a parallel move, but it's only valid
93#    for some architectures (for example x86), as other architectures may
94#    not do move at all.
95##  CHECK:       end_block
96##  CHECK-NOT:     ParallelMove
97.method public static test3Order2(ZIIIII)V
98    .registers 14
99
100    sget v0, LMain;->live1:I
101    sget v1, LMain;->live2:I
102    sget v2, LMain;->live3:I
103    sget v3, LMain;->live0:I
104    if-eqz p0, :cond_d
105
106    sput v0, LMain;->live1:I
107    goto :goto_37
108
109    :cond_d
110    sget-boolean v4, LMain;->y:Z
111    if-eqz v4, :cond_14
112
113    sput v0, LMain;->live1:I
114    goto :goto_37
115
116    :cond_14
117    sget v4, LMain;->live4:I
118    sget v5, LMain;->live5:I
119    sget-object v6, LMain;->foo:LMain$Foo;
120    add-int v7, v0, v5
121    add-int/2addr v7, v4
122    iput v7, v6, LMain$Foo;->field2:I
123    sget-object v6, LMain;->foo:LMain$Foo;
124    add-int v7, v1, v5
125    add-int/2addr v7, v4
126    iput v7, v6, LMain$Foo;->field3:I
127    sget-object v6, LMain;->foo:LMain$Foo;
128    add-int v7, v2, v5
129    add-int/2addr v7, v4
130    iput v7, v6, LMain$Foo;->field4:I
131    sget-object v6, LMain;->foo:LMain$Foo;
132    iput v4, v6, LMain$Foo;->field0:I
133    sget-object v6, LMain;->foo:LMain$Foo;
134    add-int v7, v5, v4
135    iput v7, v6, LMain$Foo;->field1:I
136    :goto_37
137
138    add-int v4, v0, v1
139    add-int/2addr v4, v2
140    add-int/2addr v4, v3
141    sput v4, LMain;->live1:I
142    return-void
143.end method
144