• 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# testing of call instructions with different arguments
15
16.record B {}
17
18.function u8 B.Bhandler_unspec(B a0) {
19    return
20}
21
22.function u8 B.Bhandler_short(B a0, u1 a1) {
23    return
24}
25
26.function u8 B.Bhandler_short2(B a0, u1[] a1, i64 a2) {
27    return
28}
29
30.function u16 B.Bhandler_long(B a0, i8 a1, i16 a2, i32 a3) {
31    return
32}
33
34.function u16 B.Bhandler_long2(B a0, i8 a1, i16 a2, i32 a3, i64 a4) {
35    return
36}
37
38.function u16 B.Bhandler_range(B a0, i8 a1, i16 a2, i32 a3, i8 a4, i16 a5, i32 a6) {
39    return
40}
41
42.function u16 long_function(i8 a0, i16 a1, i32 a2, i8 a3, i16 a4, i32 a5, i64 a6, f32 a7) {
43    return
44}
45
46# ====================
47
48.function u8 handler_unspec() {
49    return
50}
51
52.function u8 handler_short(u1 a0) {
53    return
54}
55
56.function u8 handler_short2(u1 a0, i64 a1) {
57    return
58}
59
60.function u16 handler_long(i8 a0, i16 a1, i32 a2) {
61    return
62}
63
64.function u16 handler_long2(i8 a0, i16 a1, i32 a2, f64 a3) {
65    return
66}
67
68.function u16 handler_range(i8 a0, i16 a1, i32 a2, i8 a3, i16 a4, i32 a5) {
69    return
70}
71
72# ====================
73
74.function u8 handler_unspec_ext() <external>
75
76.function u8 handler_short_ext(u1 a0) <external>
77
78.function u8 handler_short2_ext(u1 a0, i64 a1) <external>
79
80.function u16 handler_long_ext(i8 a0, i16 a1, i32 a2) <external>
81
82.function u16 handler_long2_ext(i8 a0, i16 a1, i32 a2, f64 a3) <external>
83
84.function u16 handler_range_ext(i8 a0, i16 a1, i32 a2, i8 a3, i16 a4, i32 a5) <external>
85
86.function u1 g(u1 a0) {
87    call.virt B.Bhandler_unspec, v4
88
89    call.virt B.Bhandler_short, v4, v1
90
91    call.virt B.Bhandler_short2, v4, v1, v2
92
93    call.virt B.Bhandler_long, v4, v0, v1, v2
94
95    call.virt.range B.Bhandler_range, v4
96
97    # ====================
98
99    call handler_unspec
100
101    call.short handler_short, v1
102
103    call.short handler_short2, v1, v2
104
105    call handler_long, v0, v1, v2
106
107    call handler_long2, v0, v1, v2, v3
108
109    call.range handler_range, v0
110
111    # ====================
112
113    initobj B.Bhandler_unspec
114
115    initobj.short B.Bhandler_short, v1
116
117    initobj.short B.Bhandler_short2, v1, v2
118
119    initobj B.Bhandler_long, v0, v1, v2
120
121    initobj B.Bhandler_long2, v0, v1, v2, v3
122
123    initobj.range B.Bhandler_range, v0
124
125    # ====================
126
127    call handler_unspec_ext
128
129    call.short handler_short_ext, v1
130
131    call.short handler_short2_ext, v1, v2
132
133    call handler_long_ext, v0, v1, v2
134
135    call handler_long2_ext, v0, v1, v2, v3
136
137    call.range handler_range_ext, v0
138
139    calli.dyn.short 1, v0, v0, v0
140
141    # ====================
142
143    call.acc.short handler_short, v0, 0
144
145    call.acc.short handler_short2, a0, 1
146
147    return
148}
149
150