• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14# Assert that operation initobj.range works fine
15
16.record R {
17    i32 field1
18    i32 field2
19    i32 field3
20    i32 field4
21    i32 field5
22}
23
24.function void R.ctor(R a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5) <ctor> {
25    lda a1
26    stobj a0, R.field1
27    lda a2
28    stobj a0, R.field2
29    lda a3
30    stobj a0, R.field3
31    lda a4
32    stobj a0, R.field4
33    lda a5
34    stobj a0, R.field5
35    return.void
36}
37
38.function i32 main() {
39    movi v0, 10
40    movi v1, 20
41    movi v2, 30
42    movi v3, 40
43    movi v4, 50
44    initobj.range R.ctor, v0
45    sta.obj v5
46    ldobj v5, R.field1
47    jne v0, error1
48    ldobj v5, R.field2
49    jne v1, error2
50    ldobj v5, R.field3
51    jne v2, error3
52    ldobj v5, R.field4
53    jne v3, error4
54    ldobj v5, R.field5
55    jne v4, error5
56    ldai 0
57    return
58error1:
59    ldai 1
60    return
61error2:
62    ldai 2
63    return
64error3:
65    ldai 3
66    return
67error4:
68    ldai 4
69    return
70error5:
71    ldai 5
72    return
73}
74