Skip to content

Commit 7a2b160

Browse files
authored
[libclc] Move rootn to the CLC library; optimize (#133735)
The function was already nominally in the CLC namespace; this commit just moves it over. This commit also vectorizes the builtin to avoid scalarization.
1 parent fd0785e commit 7a2b160

File tree

13 files changed

+443
-426
lines changed

13 files changed

+443
-426
lines changed

libclc/generic/include/math/clc_rootn.h renamed to libclc/clc/include/clc/math/clc_rootn.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#define __CLC_BODY <math/clc_rootn.inc>
9+
#ifndef __CLC_MATH_CLC_ROOTN_H__
10+
#define __CLC_MATH_CLC_ROOTN_H__
11+
12+
#define __CLC_BODY <clc/math/binary_decl_with_int_second_arg.inc>
13+
#define __CLC_FUNCTION __clc_rootn
14+
1015
#include <clc/math/gentype.inc>
16+
1117
#undef __CLC_BODY
18+
#undef __CLC_FUNCTION
19+
20+
#endif // __CLC_MATH_CLC_ROOTN_H__

libclc/clc/lib/generic/SOURCES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ math/clc_powr.cl
5252
math/clc_remainder.cl
5353
math/clc_remquo.cl
5454
math/clc_rint.cl
55+
math/clc_rootn.cl
5556
math/clc_round.cl
5657
math/clc_rsqrt.cl
5758
math/clc_sincos_helpers.cl
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===----------------------------------------------------------------------===//
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 <clc/clc_convert.h>
10+
#include <clc/float/definitions.h>
11+
#include <clc/internal/clc.h>
12+
#include <clc/math/clc_fabs.h>
13+
#include <clc/math/clc_fma.h>
14+
#include <clc/math/clc_ldexp.h>
15+
#include <clc/math/clc_mad.h>
16+
#include <clc/math/clc_subnormal_config.h>
17+
#include <clc/math/math.h>
18+
#include <clc/math/tables.h>
19+
20+
#define __CLC_BODY <clc_rootn.inc>
21+
#include <clc/math/gentype.inc>

0 commit comments

Comments
 (0)