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.short works fine 15 16.record R { 17 i32 field1 18 i32 field2 19} 20 21.function void R.ctor(R a0, i32 a1, i32 a2) <ctor> { 22 lda a1 23 stobj a0, R.field1 24 lda a2 25 stobj a0, R.field2 26 return.void 27} 28 29.function i32 main() { 30 movi v0, 10 31 movi v1, 20 32 initobj.short R.ctor, v0, v1 33 sta.obj v2 34 ldobj v2, R.field1 35 jne v0, error1 36 ldobj v2, R.field2 37 jne v1, error2 38 ldai 0 39 return 40error1: 41 ldai 1 42 return 43error2: 44 ldai 2 45 return 46} 47