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 operations with array of i64 works fine 15#i64 i; 16#for(i=0; i<5; i++) array[i]=i; 17#for(i=4; i>=0; i--) assert_eq(i, array[i]); 18 19.function i32 main(){ 20 movi v0, 5 #sizeof(array) 21 newarr v1, v0, i64[] 22 movi v2, 0 23 ldai 0 24loop: 25 jeq v0, loop_exit 26 i32toi64 27 starr.64 v1, v2 28 inci v2, 1 29 lda v2 30 jmp loop 31loop_exit: 32 subi 1 33 sta v2 34loop2: 35 jltz loop2_exit 36 ldarr.64 v1 37 i64toi32 38 jne v2, exit_failure 39 inci v2, -1 40 lda v2 41 jmp loop2 42loop2_exit: 43 ldai 0 44 return 45exit_failure: 46 ldai 1 47 return 48} 49