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#! CHECKER      Interop interpreter rewrite index value
15#! RUN          force_jit: true, options: "--compiler-regex=_GLOBAL::test", entry: "_GLOBAL::main", result: 1
16#! EVENT        /Compilation,_GLOBAL::test,.*COMPILED/
17#! METHOD       "_GLOBAL::test"
18
19.function i64 test(i64[] a0, i32 a1) {
20    lda a1
21    ldarr.64 a0
22    return.64
23}
24
25.function i64 main() {
26    movi v0, 5
27    newarr v1, v0, i64[]
28    # v1 <- array
29
30    ldai 1
31    i32toi64
32    movi.64 v3, 0
33    starr.64 v1, v3
34
35    movi v3, 1
36    starr.64 v1, v3
37    movi.64 v0, 0x7FFFFFFF00000001
38    # Second parameter is 32-bit, but here we call it with 64-bit
39    call.short test, v1, v0
40    return.64
41}
42