Skip to content

Commit 3d3b659

Browse files
committed
[libclc] Move clc_remquo
1 parent df19022 commit 3d3b659

File tree

12 files changed

+45
-19
lines changed

12 files changed

+45
-19
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
#ifndef __CLC_MATH_CLC_REMQUO_H__
10+
#define __CLC_MATH_CLC_REMQUO_H__
11+
12+
#define __CLC_FUNCTION __clc_remquo
13+
14+
#define __CLC_BODY <clc/math/remquo_decl.inc>
15+
#define __CLC_ADDRESS_SPACE private
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_ADDRESS_SPACE
19+
#undef __CLC_BODY
20+
#undef __CLC_FUNCTION
21+
22+
#endif // __CLC_MATH_CLC_REMQUO_H__
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(
10+
__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_ADDRESS_SPACE __CLC_INTN *q);

libclc/clc/lib/generic/SOURCES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ math/clc_modf.cl
3434
math/clc_nan.cl
3535
math/clc_nextafter.cl
3636
math/clc_remainder.cl
37+
math/clc_remquo.cl
3738
math/clc_rint.cl
3839
math/clc_round.cl
3940
math/clc_rsqrt.cl

libclc/generic/lib/math/clc_remquo.cl renamed to libclc/clc/lib/generic/math/clc_remquo.cl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <clc/clc.h>
109
#include <clc/clc_convert.h>
1110
#include <clc/clcmacro.h>
1211
#include <clc/integer/clc_clz.h>
12+
#include <clc/internal/clc.h>
1313
#include <clc/math/clc_floor.h>
1414
#include <clc/math/clc_fma.h>
15+
#include <clc/math/clc_ldexp.h>
1516
#include <clc/math/clc_subnormal_config.h>
1617
#include <clc/math/clc_trunc.h>
1718
#include <clc/math/math.h>
@@ -115,6 +116,9 @@ __VEC_REMQUO(float, 8, 4)
115116
__VEC_REMQUO(float, 16, 8)
116117

117118
#ifdef cl_khr_fp64
119+
120+
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
121+
118122
_CLC_DEF _CLC_OVERLOAD double __clc_remquo(double x, double y,
119123
__private int *pquo) {
120124
ulong ux = __clc_as_ulong(x);
@@ -143,7 +147,7 @@ _CLC_DEF _CLC_OVERLOAD double __clc_remquo(double x, double y,
143147
// but it doesn't matter - it just means that we'll go round
144148
// the loop below one extra time.
145149
int ntimes = __clc_max(0, (xexp1 - yexp1) / 53);
146-
double w = ldexp(dy, ntimes * 53);
150+
double w = __clc_ldexp(dy, ntimes * 53);
147151
w = ntimes == 0 ? dy : w;
148152
double scale = ntimes == 0 ? 1.0 : 0x1.0p-53;
149153

libclc/clspv/lib/SOURCES

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ subnormal_config.cl
2020
../../generic/lib/math/clc_pow.cl
2121
../../generic/lib/math/clc_pown.cl
2222
../../generic/lib/math/clc_powr.cl
23-
../../generic/lib/math/clc_remquo.cl
2423
../../generic/lib/math/clc_rootn.cl
2524
../../generic/lib/math/clc_tan.cl
2625
../../generic/lib/math/clc_tanpi.cl

libclc/generic/include/clc/math/remquo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#define __CLC_FUNCTION remquo
22

3-
#define __CLC_BODY <clc/math/remquo.inc>
3+
#define __CLC_BODY <clc/math/remquo_decl.inc>
44
#define __CLC_ADDRESS_SPACE global
55
#include <clc/math/gentype.inc>
66
#undef __CLC_ADDRESS_SPACE
77

8-
#define __CLC_BODY <clc/math/remquo.inc>
8+
#define __CLC_BODY <clc/math/remquo_decl.inc>
99
#define __CLC_ADDRESS_SPACE local
1010
#include <clc/math/gentype.inc>
1111
#undef __CLC_ADDRESS_SPACE
1212

13-
#define __CLC_BODY <clc/math/remquo.inc>
13+
#define __CLC_BODY <clc/math/remquo_decl.inc>
1414
#define __CLC_ADDRESS_SPACE private
1515
#include <clc/math/gentype.inc>
1616
#undef __CLC_ADDRESS_SPACE

libclc/generic/include/clc/math/remquo.inc

Lines changed: 0 additions & 1 deletion
This file was deleted.

libclc/generic/include/math/clc_remquo.h

Lines changed: 0 additions & 8 deletions
This file was deleted.

libclc/generic/lib/SOURCES

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ math/pown.cl
164164
math/clc_powr.cl
165165
math/powr.cl
166166
math/remainder.cl
167-
math/clc_remquo.cl
168167
math/remquo.cl
169168
math/rint.cl
170169
math/clc_rootn.cl

libclc/generic/lib/math/remquo.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <clc/clc.h>
2-
#include <math/clc_remquo.h>
2+
#include <clc/math/clc_remquo.h>
33

44
#define __CLC_BODY <remquo.inc>
55
#define __CLC_ADDRESS_SPACE global

libclc/generic/lib/math/remquo.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE remquo(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_ADDRESS_SPACE __CLC_INTN *q) {
1+
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE remquo(__CLC_GENTYPE x, __CLC_GENTYPE y,
2+
__CLC_ADDRESS_SPACE __CLC_INTN *q) {
23
__CLC_INTN local_q;
34
__CLC_GENTYPE ret = __clc_remquo(x, y, &local_q);
45
*q = local_q;

libclc/spirv/lib/SOURCES

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ math/fma.cl
6666
../../generic/lib/math/clc_powr.cl
6767
../../generic/lib/math/powr.cl
6868
../../generic/lib/math/remainder.cl
69-
../../generic/lib/math/clc_remquo.cl
7069
../../generic/lib/math/remquo.cl
7170
../../generic/lib/math/clc_rootn.cl
7271
../../generic/lib/math/rootn.cl

0 commit comments

Comments
 (0)