1/* SPDX-License-Identifier: BSD-2-Clause */ 2/* 3 * Copyright 2022 NXP 4 */ 5 6 .altmacro 7 /* 8 * Multiplication macro for RISC-V harts without M extension. 9 */ 10 .macro mult, reg_op0, reg_op1, reg_res 11 li \reg_res, 0 12 mv a0, \reg_op0 13 mv a1, \reg_op1 14 mv a2, a0 15 li a0, 0 16 1: 17 andi a3, a1, 1 18 beqz a3, 2f 19 add a0, a0, a2 20 2: 21 srli a1, a1, 1 22 slli a2, a2, 1 23 bnez a1, 1b 24 add \reg_res, \reg_res, a0 25 .endm 26