1/** 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#define DEFAULT_SHORTY_PTR_REG r0 17#define DEFAULT_SHORTY_REG r1 18 19.syntax unified 20 21.macro INIT_SHORTY_REG shorty_reg = DEFAULT_SHORTY_REG, shorty_ptr_reg = DEFAULT_SHORTY_PTR_REG 22 ldrh \shorty_reg, [\shorty_ptr_reg], #2 // read new shorty value and advance shorty_ptr 23 movt \shorty_reg, #0xFFFF 24.endm 25 26.macro NEXT_SHORTY out_reg, shorty_reg = DEFAULT_SHORTY_REG, shorty_ptr_reg = DEFAULT_SHORTY_PTR_REG 27 cmn \shorty_reg, #1 // check shorty_reg = 0xFFFFFFFF 28 ldrheq \shorty_reg, [\shorty_ptr_reg], #2 // read new shorty value and advance shorty_ptr 29 movteq \shorty_reg, #0xFFFF 30 and \out_reg, \shorty_reg, #0xF // extract next shorty value 31 lsr \shorty_reg, \shorty_reg, #4 32 orr \shorty_reg, \shorty_reg, #0xF0000000 // fill the high 20 bits by 0xFFFFF 33.endm 34 35.macro SKIP_SHORTY shorty_reg = DEFAULT_SHORTY_REG, shorty_ptr_reg = DEFAULT_SHORTY_PTR_REG 36 cmn \shorty_reg, #1 // check shorty_reg = 0xFFFFFFFF 37 ldrheq \shorty_reg, [\shorty_ptr_reg], #2 // read new shorty value and advance shorty_ptr 38 movteq \shorty_reg, #0xFFFF 39 lsr \shorty_reg, \shorty_reg, #4 40 orr \shorty_reg, \shorty_reg, #0xF0000000 // fill the high 20 bits by 0xFFFFF 41.endm 42 43