The RISC-V implementations of the `__mulsi3`, `__muldi3` builtins were conditionally compiling the actual function definitions depending on whether the M extension was present or not. This caused Compiler-RT testing failures for RISC-V targets with the M extension, as when these sources were included the `librt_has_mul*i3` features were still being defined. These `librt_has_*` definitions are used to conditionally run the respective tests. Since the actual functions were not being compiled-in, the generic test for `__muldi3` would fail. This patch makes these implementations follow the normal Compiler-RT convention of always including the definition, and conditionally running the respective tests by using the lit conditional `REQUIRES: librt_has_*`. Since the `mulsi3_test.c` wasn't actually RISC-V-specific, this patch also moves it out of the `riscv` directory. It now only depends on `librt_has_mulsi3` to run. Differential Revision: https://reviews.llvm.org/D86457
34 lines
815 B
PHP
34 lines
815 B
PHP
//===-- 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef __mulxi3
|
|
#error "__mulxi3 must be defined to use this generic implementation"
|
|
#endif
|
|
|
|
.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
|