Skip to content

Commit 11aa948

Browse files
committed
add: mulifx functions
1 parent 28d8e87 commit 11aa948

17 files changed

+348
-0
lines changed

libc/src/stdfix/CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ foreach(suffix IN ITEMS r lr k lk ur ulr uk ulk)
8787
DEPENDS
8888
libc.src.__support.fixed_point.fx_bits
8989
)
90+
91+
add_entrypoint_object(
92+
muli${suffix}
93+
HDRS
94+
muli${suffix}.h
95+
SRCS
96+
muli${suffix}.cpp
97+
COMPILE_OPTIONS
98+
${libc_opt_high_flag}
99+
DEPENDS
100+
libc.src.__support.fixed_point.fx_bits
101+
)
90102
endforeach()
91103

92104
add_entrypoint_object(

libc/src/stdfix/mulik.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation of mulik function --------------------------------===//
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+
#include "mulik.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // accum
11+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
12+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
LLVM_LIBC_FUNCTION(int, mulik, (accum f, int i)) {
18+
return fixed_point::muli(f, i);
19+
}
20+
21+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/mulik.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for mulik ------------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_STDFIX_MULIK_H
10+
#define LLVM_LIBC_SRC_STDFIX_MULIK_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // accum
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
int mulik(accum f, int i);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_STDFIX_MULIK_H

libc/src/stdfix/mulilk.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation of mulilk function --------------------------------===//
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+
#include "mulilk.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // long accum
11+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
12+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
LLVM_LIBC_FUNCTION(long int, mulilk, (long accum f, long int i)) {
18+
return fixed_point::muli(f, i);
19+
}
20+
21+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/mulilk.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for mulilk ------------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_STDFIX_MULILK_H
10+
#define LLVM_LIBC_SRC_STDFIX_MULILK_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // accum
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
long int mulilk(long accum f, long int i);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_STDFIX_MULILK_H

libc/src/stdfix/mulilr.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation of mulilr function ---------------------------------===//
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+
#include "mulilr.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // fract
11+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
12+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
LLVM_LIBC_FUNCTION(long int, mulilr, (long fract f, long int i)) {
18+
return fixed_point::muli(f, i);
19+
}
20+
21+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/mulilr.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for mulilr -----------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_STDFIX_MULILR_H
10+
#define LLVM_LIBC_SRC_STDFIX_MULILR_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // long fract
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
long int mulilr(long fract f, long int i);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_STDFIX_MULILR_H

libc/src/stdfix/mulir.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation of mulir function ---------------------------------===//
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+
#include "mulir.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // fract
11+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
12+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
LLVM_LIBC_FUNCTION(int, mulir, (fract f, int i)) {
18+
return fixed_point::muli(f, i);
19+
}
20+
21+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/mulir.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for mulir -----------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_STDFIX_MULIR_H
10+
#define LLVM_LIBC_SRC_STDFIX_MULIR_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // long fract
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
int mulir(fract f, int i);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_STDFIX_MULIR_H

libc/src/stdfix/muliuk.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for muliuk ------------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_STDFIX_MULIUK_H
10+
#define LLVM_LIBC_SRC_STDFIX_MULIUK_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned accum
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
unsigned int muliuk(unsigned accum f, unsigned int i);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_STDFIX_MULIUK_H

libc/src/stdfix/muliuk.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for muliuk -----------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_STDFIX_MULIUK_H
10+
#define LLVM_LIBC_SRC_STDFIX_MULIUK_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned accum
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
unsigned int muliuk(unsigned accum f, unsigned int i);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_STDFIX_MULIUK_H

libc/src/stdfix/muliulk.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation of muliulk function -------------------------------===//
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+
#include "muliulk.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned long accum
11+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
12+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
LLVM_LIBC_FUNCTION(unsigned long int, muliulk, (unsigned long accum f, unsigned long int i)) {
18+
return fixed_point::muli(f, i);
19+
}
20+
21+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/muliulk.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for muliulk -----------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_STDFIX_MULIULK_H
10+
#define LLVM_LIBC_SRC_STDFIX_MULIULK_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned accum
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
unsigned long int muliulk(unsigned long accum f, unsigned long int i);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_STDFIX_MULIULK_H

libc/src/stdfix/muliulr.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation of muliulr function --------------------------------===//
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+
#include "muliulr.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned long fract
11+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
12+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
LLVM_LIBC_FUNCTION(unsigned long int, muliulr, (unsigned long fract f, unsigned long int i)) {
18+
return fixed_point::muli(f, i);
19+
}
20+
21+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/muliulr.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for muliulr -----------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_STDFIX_MULIULR_H
10+
#define LLVM_LIBC_SRC_STDFIX_MULIULR_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned fract
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
unsigned long int muliulr(unsigned long fract f, unsigned long int i);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_STDFIX_MULIULR_H

libc/src/stdfix/muliur.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation of muliur function ---------------------------------===//
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+
#include "muliur.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // fract
11+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
12+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
LLVM_LIBC_FUNCTION(unsigned int, muliur, (unsigned fract f, unsigned int i)) {
18+
return fixed_point::muli(f, i);
19+
}
20+
21+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/muliur.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for muliur -----------------------*- C++ -*-===//
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+
#ifndef LLVM_LIBC_SRC_STDFIX_MULIUR_H
10+
#define LLVM_LIBC_SRC_STDFIX_MULIUR_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned fract
13+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
unsigned int muliur(unsigned fract f, unsigned int i);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_STDFIX_MULIUR_H

0 commit comments

Comments
 (0)