Skip to content

Commit c45bf58

Browse files
committed
nit
1 parent b606662 commit c45bf58

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

libc/src/math/generic/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ add_header_library(
356356
HDRS
357357
sincosf16_utils.h
358358
DEPENDS
359-
.range_reduction
360359
libc.src.__support.FPUtil.fp_bits
361360
libc.src.__support.FPUtil.polyeval
362361
libc.src.__support.FPUtil.nearest_integer

libc/src/math/generic/cospif16.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/math/cospif16.h"
10+
#include "hdr/errno_macros.h"
11+
#include "hdr/fenv_macros.h"
1012
#include "sincosf16_utils.h"
1113
#include "src/__support/FPUtil/FEnvImpl.h"
1214
#include "src/__support/FPUtil/FPBits.h"
1315
#include "src/__support/FPUtil/cast.h"
1416
#include "src/__support/FPUtil/multiply_add.h"
17+
#include "src/__support/macros/optimization.h"
1518

1619
namespace LIBC_NAMESPACE_DECL {
20+
1721
LLVM_LIBC_FUNCTION(float16, cospif16, (float16 x)) {
1822
using FPBits = typename fputil::FPBits<float16>;
1923
FPBits xbits(x);
@@ -49,9 +53,8 @@ LLVM_LIBC_FUNCTION(float16, cospif16, (float16 x)) {
4953

5054
// Numbers greater or equal to 2^10 are integers, or infinity, or NaN
5155
if (LIBC_UNLIKELY(x_abs >= 0x6400)) {
52-
if (LIBC_UNLIKELY(x_abs <= 0x67FF)) {
56+
if (LIBC_UNLIKELY(x_abs <= 0x67FF))
5357
return fputil::cast<float16>((x_abs & 0x1) ? -1.0f : 1.0f);
54-
}
5558

5659
// Check for NaN or infintiy values
5760
if (LIBC_UNLIKELY(x_abs >= 0x7c00)) {

libc/src/math/generic/sincosf16_utils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
89
#ifndef LLVM_LIBC_SRC_MATH_GENERIC_SINCOSF16_UTILS_H
910
#define LLVM_LIBC_SRC_MATH_GENERIC_SINCOSF16_UTILS_H
1011

@@ -38,7 +39,7 @@ constexpr float SIN_K_PI_OVER_32[64] = {
3839
-0x1.6a09e6p-1, -0x1.44cf32p-1, -0x1.1c73b4p-1, -0x1.e2b5d4p-2,
3940
-0x1.87de2ap-2, -0x1.294062p-2, -0x1.8f8b84p-3, -0x1.917a6cp-4};
4041

41-
LIBC_INLINE int32_t range_reduction(float x, float &y) {
42+
LIBC_INLINE int32_t range_reduction_sincospif16(float x, float &y) {
4243
float kf = fputil::nearest_integer(x * 32);
4344
y = fputil::multiply_add<float>(x, 32.0, -kf);
4445

@@ -48,7 +49,7 @@ LIBC_INLINE int32_t range_reduction(float x, float &y) {
4849
LIBC_INLINE void sincospif16_eval(float xf, float &sin_k, float &cos_k,
4950
float &sin_y, float &cosm1_y) {
5051
float y;
51-
int32_t k = range_reduction(xf, y);
52+
int32_t k = range_reduction_sincospif16(xf, y);
5253

5354
sin_k = SIN_K_PI_OVER_32[k & 63];
5455
cos_k = SIN_K_PI_OVER_32[(k + 16) & 63];

0 commit comments

Comments
 (0)