summaryrefslogtreecommitdiff
path: root/compiler-rt/lib/builtins/riscv/int_mul_impl.inc
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-06-27 18:34:17 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-06-27 18:34:17 +0000
commitdbb6490749e2bb2a514a8a305b8fadc3495183e6 (patch)
treedd42cfd6d9813d5640a01083bdc0eedcb3f862c2 /compiler-rt/lib/builtins/riscv/int_mul_impl.inc
parent483b61a50e7423b063fc26985325f594560b3f7e (diff)
Notes
Diffstat (limited to 'compiler-rt/lib/builtins/riscv/int_mul_impl.inc')
-rw-r--r--compiler-rt/lib/builtins/riscv/int_mul_impl.inc31
1 files changed, 31 insertions, 0 deletions
diff --git a/compiler-rt/lib/builtins/riscv/int_mul_impl.inc b/compiler-rt/lib/builtins/riscv/int_mul_impl.inc
new file mode 100644
index 0000000000000..50951d5f4195f
--- /dev/null
+++ b/compiler-rt/lib/builtins/riscv/int_mul_impl.inc
@@ -0,0 +1,31 @@
+//===-- int_mul_impl.inc - Integer multiplication -------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Helpers used by __mulsi3, __muldi3.
+//
+//===----------------------------------------------------------------------===//
+
+#if !defined(__riscv_mul)
+ .text
+ .align 2
+
+ .globl __mulxi3
+ .type __mulxi3, @function
+__mulxi3:
+ mv a2, a0
+ mv a0, zero
+.L1:
+ andi a3, a1, 1
+ beqz a3, .L2
+ add a0, a0, a2
+.L2:
+ srli a1, a1, 1
+ slli a2, a2, 1
+ bnez a1, .L1
+ ret
+#endif