xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/riscv/mulsi3.S (revision 580744621f33383027108364dcadad718df46ffe)
1//===--- mulsi3.S - Integer multiplication routines routines ---===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#if !defined(__riscv_mul) && __riscv_xlen == 32
10	.text
11	.align 2
12
13	.globl __mulsi3
14	.type  __mulsi3, @function
15__mulsi3:
16	mv     a2, a0
17	mv     a0, zero
18.L1:
19	andi   a3, a1, 1
20	beqz   a3, .L2
21	add    a0, a0, a2
22.L2:
23	srli   a1, a1, 1
24	slli   a2, a2, 1
25	bnez   a1, .L1
26	ret
27#endif
28