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#include "arch/asm_support.h" 17 18#define DEFAULT_SHORTY_PTR_REG x0 19#define DEFAULT_SHORTY_REG w1 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.endm 24 25.macro NEXT_SHORTY out_reg, shorty_reg = DEFAULT_SHORTY_REG, shorty_ptr_reg = DEFAULT_SHORTY_PTR_REG 26 cmn \shorty_reg, #1 // check shorty_reg = 0xFFFFFFFF 27 bne 1f 28 ldrh \shorty_reg, [\shorty_ptr_reg], #2 // read new shorty value and advance shorty_ptr 291: 30 and \out_reg, \shorty_reg, #0xF // extract next shorty value 31 lsr \shorty_reg, \shorty_reg, #4 32 orr \shorty_reg, \shorty_reg, #0xFFFFF000 // 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 bne 1f 38 ldrh \shorty_reg, [\shorty_ptr_reg], #2 // read new shorty value and advance shorty_ptr 391: 40 lsr \shorty_reg, \shorty_reg, #4 41 orr \shorty_reg, \shorty_reg, #0xFFFFF000 // fill the high 20 bits by 0xFFFFF 42.endm 43