xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/riscv/int_mul_impl.inc (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1//===-- int_mul_impl.inc - Integer multiplication -------------------------===//
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// Helpers used by __mulsi3, __muldi3.
10//
11//===----------------------------------------------------------------------===//
12
13#if !defined(__riscv_mul)
14	.text
15	.align 2
16
17	.globl __mulxi3
18	.type  __mulxi3, @function
19__mulxi3:
20	mv     a2, a0
21	mv     a0, zero
22.L1:
23	andi   a3, a1, 1
24	beqz   a3, .L2
25	add    a0, a0, a2
26.L2:
27	srli   a1, a1, 1
28	slli   a2, a2, 1
29	bnez   a1, .L1
30	ret
31#endif
32