Skip to content

Commit 837d5a7

Browse files
authored
[libclc][NFC] Remove unary_builtin.inc (#137656)
We had two ways of achieving the same thing. This commit removes unary_builtin.inc in favour of the approach combining gentype.inc with unary_def.inc. There is no change to the codegen for any target.
1 parent 1e31f4b commit 837d5a7

23 files changed

+93
-111
lines changed

libclc/clc/include/clc/math/unary_builtin.inc

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

libclc/clc/lib/generic/math/clc_ceil.cl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include <clc/internal/clc.h>
1010

11-
#undef __CLC_FUNCTION
12-
#define __CLC_FUNCTION __clc_ceil
13-
#define __CLC_BUILTIN __builtin_elementwise_ceil
14-
#include <clc/math/unary_builtin.inc>
11+
#define FUNCTION __clc_ceil
12+
#define __CLC_FUNCTION(x) __builtin_elementwise_ceil
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/clc/lib/generic/math/clc_fabs.cl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include <clc/internal/clc.h>
1010

11-
#undef __CLC_FUNCTION
12-
#define __CLC_FUNCTION __clc_fabs
13-
#define __CLC_BUILTIN __builtin_elementwise_abs
14-
#include <clc/math/unary_builtin.inc>
11+
#define FUNCTION __clc_fabs
12+
#define __CLC_FUNCTION(x) __builtin_elementwise_abs
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/clc/lib/generic/math/clc_floor.cl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include <clc/internal/clc.h>
1010

11-
#undef __CLC_FUNCTION
12-
#define __CLC_FUNCTION __clc_floor
13-
#define __CLC_BUILTIN __builtin_elementwise_floor
14-
#include <clc/math/unary_builtin.inc>
11+
#define FUNCTION __clc_floor
12+
#define __CLC_FUNCTION(x) __builtin_elementwise_floor
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/clc/lib/generic/math/clc_rint.cl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include <clc/internal/clc.h>
1010

11-
#undef __CLC_FUNCTION
12-
#define __CLC_FUNCTION __clc_rint
13-
#define __CLC_BUILTIN __builtin_elementwise_rint
14-
#include <clc/math/unary_builtin.inc>
11+
#define FUNCTION __clc_rint
12+
#define __CLC_FUNCTION(x) __builtin_elementwise_rint
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/clc/lib/generic/math/clc_round.cl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include <clc/internal/clc.h>
1010

11-
#undef __CLC_FUNCTION
12-
#define __CLC_FUNCTION __clc_round
13-
#define __CLC_BUILTIN __builtin_elementwise_round
14-
#include <clc/math/unary_builtin.inc>
11+
#define FUNCTION __clc_round
12+
#define __CLC_FUNCTION(x) __builtin_elementwise_round
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/clc/lib/generic/math/clc_trunc.cl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include <clc/internal/clc.h>
1010

11-
#undef __CLC_FUNCTION
12-
#define __CLC_FUNCTION __clc_trunc
13-
#define __CLC_BUILTIN __builtin_elementwise_trunc
14-
#include <clc/math/unary_builtin.inc>
11+
#define FUNCTION __clc_trunc
12+
#define __CLC_FUNCTION(x) __builtin_elementwise_trunc
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/acos.cl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <clc/clc.h>
10-
#include <clc/clcmacro.h>
1110
#include <clc/math/clc_acos.h>
1211

13-
#undef __CLC_FUNCTION
14-
#define __CLC_FUNCTION acos
15-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION acos
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/acosh.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <clc/clc.h>
1010
#include <clc/math/clc_acosh.h>
1111

12-
#undef __CLC_FUNCTION
13-
#define __CLC_FUNCTION acosh
14-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION acosh
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/acospi.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <clc/clc.h>
1010
#include <clc/math/clc_acospi.h>
1111

12-
#undef __CLC_FUNCTION
13-
#define __CLC_FUNCTION acospi
14-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION acospi
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
1514

15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/asin.cl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <clc/clc.h>
10-
#include <clc/clcmacro.h>
1110
#include <clc/math/clc_asin.h>
1211

13-
#undef __CLC_FUNCTION
14-
#define __CLC_FUNCTION asin
15-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION asin
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/asinh.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <clc/clc.h>
1010
#include <clc/math/clc_asinh.h>
1111

12-
#undef __CLC_FUNCTION
13-
#define __CLC_FUNCTION asinh
14-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION asinh
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/asinpi.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <clc/clc.h>
1010
#include <clc/math/clc_asinpi.h>
1111

12-
#undef __CLC_FUNCTION
13-
#define __CLC_FUNCTION asinpi
14-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION asinpi
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/atan.cl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <clc/clc.h>
10-
#include <clc/clcmacro.h>
1110
#include <clc/math/clc_atan.h>
1211

13-
#undef __CLC_FUNCTION
14-
#define __CLC_FUNCTION atan
15-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION atan
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/atanh.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <clc/clc.h>
1010
#include <clc/math/clc_atanh.h>
1111

12-
#undef __CLC_FUNCTION
13-
#define __CLC_FUNCTION atanh
14-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION atanh
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/atanpi.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <clc/clc.h>
1010
#include <clc/math/clc_atanpi.h>
1111

12-
#undef __CLC_FUNCTION
13-
#define __CLC_FUNCTION atanpi
14-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION atanpi
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/ceil.cl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <clc/clc.h>
10-
#include <clc/clcmacro.h>
1110
#include <clc/math/clc_ceil.h>
1211

13-
#undef __CLC_FUNCTION
14-
#define __CLC_FUNCTION ceil
15-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION ceil
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/fabs.cl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <clc/clc.h>
10-
#include <clc/clcmacro.h>
1110
#include <clc/math/clc_fabs.h>
1211

13-
#undef __CLC_FUNCTION
14-
#define __CLC_FUNCTION fabs
15-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION fabs
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/floor.cl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <clc/clc.h>
10-
#include <clc/clcmacro.h>
1110
#include <clc/math/clc_floor.h>
1211

13-
#undef __CLC_FUNCTION
14-
#define __CLC_FUNCTION floor
15-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION floor
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/log1p.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <clc/clc.h>
1010
#include <clc/math/clc_log1p.h>
1111

12-
#undef __CLC_FUNCTION
13-
#define __CLC_FUNCTION log1p
14-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION log1p
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/rint.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <clc/clc.h>
1010
#include <clc/math/clc_rint.h>
1111

12-
#undef __CLC_FUNCTION
13-
#define __CLC_FUNCTION rint
14-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION rint
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/round.cl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <clc/clc.h>
10-
#include <clc/clcmacro.h>
1110
#include <clc/math/clc_round.h>
1211

13-
#undef __CLC_FUNCTION
14-
#define __CLC_FUNCTION round
15-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION round
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

libclc/generic/lib/math/trunc.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <clc/clc.h>
1010
#include <clc/math/clc_trunc.h>
1111

12-
#undef __CLC_FUNCTION
13-
#define __CLC_FUNCTION trunc
14-
#include <clc/math/unary_builtin.inc>
12+
#define FUNCTION trunc
13+
#define __CLC_BODY <clc/shared/unary_def.inc>
14+
15+
#include <clc/math/gentype.inc>

0 commit comments

Comments
 (0)