[libclc] r313107 - Add native_recip(x) as ((1)/(x))

2017-09-12 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Tue Sep 12 18:40:25 2017
New Revision: 313107

URL: http://llvm.org/viewvc/llvm-project?rev=313107=rev
Log:
Add native_recip(x) as ((1)/(x))

Signed-off-by: Aaron Watry 
Acked-by: Jan Vesely 

Added:
libclc/trunk/generic/include/clc/math/native_recip.h
Modified:
libclc/trunk/generic/include/clc/clc.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=313107=313106=313107=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Sep 12 18:40:25 2017
@@ -106,6 +106,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Added: libclc/trunk/generic/include/clc/math/native_recip.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_recip.h?rev=313107=auto
==
--- libclc/trunk/generic/include/clc/math/native_recip.h (added)
+++ libclc/trunk/generic/include/clc/math/native_recip.h Tue Sep 12 18:40:25 
2017
@@ -0,0 +1 @@
+#define native_recip(x) ((1) / (x))


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] r312854 - integer: Add popcount implementation using ctpop intrinsic

2017-09-08 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Fri Sep  8 19:23:54 2017
New Revision: 312854

URL: http://llvm.org/viewvc/llvm-project?rev=312854=rev
Log:
integer: Add popcount implementation using ctpop intrinsic

Also copy/modify the unary_intrin.inc from math/ to make the
intrinsic declaration somewhat reusable.

Passes CL CTS integer_ops/test_integer_ops popcount tests for CL 1.2

Tested-by on GCN 1.0 (Pitcairn)

Signed-off-by: Aaron Watry 
Reviewed-by: Jan Vesely 

Added:
libclc/trunk/generic/include/clc/integer/popcount.h
libclc/trunk/generic/include/clc/integer/unary_intrin.inc
Modified:
libclc/trunk/generic/include/clc/clc.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=312854=312853=312854=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep  8 19:23:54 2017
@@ -126,6 +126,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Added: libclc/trunk/generic/include/clc/integer/popcount.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/integer/popcount.h?rev=312854=auto
==
--- libclc/trunk/generic/include/clc/integer/popcount.h (added)
+++ libclc/trunk/generic/include/clc/integer/popcount.h Fri Sep  8 19:23:54 2017
@@ -0,0 +1,6 @@
+#undef popcount
+#define popcount __clc_popcount
+
+#define __CLC_FUNCTION __clc_popcount
+#define __CLC_INTRINSIC "llvm.ctpop"
+#include 

Added: libclc/trunk/generic/include/clc/integer/unary_intrin.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/integer/unary_intrin.inc?rev=312854=auto
==
--- libclc/trunk/generic/include/clc/integer/unary_intrin.inc (added)
+++ libclc/trunk/generic/include/clc/integer/unary_intrin.inc Fri Sep  8 
19:23:54 2017
@@ -0,0 +1,20 @@
+#define __CLC_INTRINSIC_DEF(SCALAR_TYPE, BIT_SIZE) \
+_CLC_OVERLOAD SCALAR_TYPE __CLC_FUNCTION(SCALAR_TYPE x) __asm(__CLC_INTRINSIC 
".i" BIT_SIZE); \
+_CLC_OVERLOAD SCALAR_TYPE##2 __CLC_FUNCTION(SCALAR_TYPE##2 x) 
__asm(__CLC_INTRINSIC ".v2i" BIT_SIZE); \
+_CLC_OVERLOAD SCALAR_TYPE##3 __CLC_FUNCTION(SCALAR_TYPE##3 x) 
__asm(__CLC_INTRINSIC ".v3i" BIT_SIZE); \
+_CLC_OVERLOAD SCALAR_TYPE##4 __CLC_FUNCTION(SCALAR_TYPE##4 x) 
__asm(__CLC_INTRINSIC ".v4i" BIT_SIZE); \
+_CLC_OVERLOAD SCALAR_TYPE##8 __CLC_FUNCTION(SCALAR_TYPE##8 x) 
__asm(__CLC_INTRINSIC ".v8i" BIT_SIZE); \
+_CLC_OVERLOAD SCALAR_TYPE##16 __CLC_FUNCTION(SCALAR_TYPE##16 x) 
__asm(__CLC_INTRINSIC ".v16i" BIT_SIZE);
+
+__CLC_INTRINSIC_DEF(char, "8")
+__CLC_INTRINSIC_DEF(uchar, "8")
+__CLC_INTRINSIC_DEF(short, "16")
+__CLC_INTRINSIC_DEF(ushort, "16")
+__CLC_INTRINSIC_DEF(int, "32")
+__CLC_INTRINSIC_DEF(uint, "32")
+__CLC_INTRINSIC_DEF(long, "64")
+__CLC_INTRINSIC_DEF(ulong, "64")
+
+#undef __CLC_FUNCTION
+#undef __CLC_INTRINSIC
+#undef __CLC_INTRINSIC_DEF


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] r312404 - relational: Implement shuffle2 builtin

2017-09-01 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Fri Sep  1 19:23:28 2017
New Revision: 312404

URL: http://llvm.org/viewvc/llvm-project?rev=312404=rev
Log:
relational: Implement shuffle2 builtin

This was added in CL 1.1

Tested with a Radeon HD 7850 (Pitcairn) using the CL CTS via:
test_conformance/relationals/test_relationals shuffle_built_in_dual_input

v2: Add half support to shuffle2
Move shuffle2 to misc/

Signed-off-by: Aaron Watry 
Reviewed-by: Jan Vesely 

Added:
libclc/trunk/generic/include/clc/misc/shuffle2.h
libclc/trunk/generic/lib/misc/shuffle2.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=312404=312403=312404=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep  1 19:23:28 2017
@@ -239,6 +239,7 @@
 
 /* 6.12.12 Miscellaneous Vector Functions */
 #include 
+#include 
 
 #include 
 #include 

Added: libclc/trunk/generic/include/clc/misc/shuffle2.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/misc/shuffle2.h?rev=312404=auto
==
--- libclc/trunk/generic/include/clc/misc/shuffle2.h (added)
+++ libclc/trunk/generic/include/clc/misc/shuffle2.h Fri Sep  1 19:23:28 2017
@@ -0,0 +1,47 @@
+//===-- generic/include/clc/misc/shuffle2.h --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under both the University of Illinois Open Source
+// License and the MIT license. See LICENSE.TXT for details.
+//
+//===--===//
+
+#define _CLC_SHUFFLE2_DECL(TYPE, MASKTYPE, RETTYPE) \
+  _CLC_OVERLOAD _CLC_DECL RETTYPE shuffle2(TYPE x, TYPE y, MASKTYPE mask);
+
+//Return type is same base type as the input type, with the same vector size 
as the mask.
+//Elements in the mask must be the same size (number of bits) as the input 
value.
+//E.g. char8 ret = shuffle2(char2 x, char2 y, uchar8 mask);
+
+#define _CLC_VECTOR_SHUFFLE2_MASKSIZE(INBASE, INTYPE, MASKTYPE) \
+  _CLC_SHUFFLE2_DECL(INTYPE, MASKTYPE##2, INBASE##2) \
+  _CLC_SHUFFLE2_DECL(INTYPE, MASKTYPE##4, INBASE##4) \
+  _CLC_SHUFFLE2_DECL(INTYPE, MASKTYPE##8, INBASE##8) \
+  _CLC_SHUFFLE2_DECL(INTYPE, MASKTYPE##16, INBASE##16) \
+
+#define _CLC_VECTOR_SHUFFLE2_INSIZE(TYPE, MASKTYPE) \
+  _CLC_VECTOR_SHUFFLE2_MASKSIZE(TYPE, TYPE##2, MASKTYPE) \
+  _CLC_VECTOR_SHUFFLE2_MASKSIZE(TYPE, TYPE##4, MASKTYPE) \
+  _CLC_VECTOR_SHUFFLE2_MASKSIZE(TYPE, TYPE##8, MASKTYPE) \
+  _CLC_VECTOR_SHUFFLE2_MASKSIZE(TYPE, TYPE##16, MASKTYPE) \
+
+_CLC_VECTOR_SHUFFLE2_INSIZE(char, uchar)
+_CLC_VECTOR_SHUFFLE2_INSIZE(short, ushort)
+_CLC_VECTOR_SHUFFLE2_INSIZE(int, uint)
+_CLC_VECTOR_SHUFFLE2_INSIZE(long, ulong)
+_CLC_VECTOR_SHUFFLE2_INSIZE(uchar, uchar)
+_CLC_VECTOR_SHUFFLE2_INSIZE(ushort, ushort)
+_CLC_VECTOR_SHUFFLE2_INSIZE(uint, uint)
+_CLC_VECTOR_SHUFFLE2_INSIZE(ulong, ulong)
+_CLC_VECTOR_SHUFFLE2_INSIZE(float, uint)
+#ifdef cl_khr_fp64
+_CLC_VECTOR_SHUFFLE2_INSIZE(double, ulong)
+#endif
+#ifdef cl_khr_fp16
+_CLC_VECTOR_SHUFFLE2_INSIZE(half, ushort)
+#endif
+
+#undef _CLC_SHUFFLE_DECL
+#undef _CLC_VECTOR_SHUFFLE2_MASKSIZE
+#undef _CLC_VECTOR_SHUFFLE2_INSIZE

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=312404=312403=312404=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Sep  1 19:23:28 2017
@@ -124,6 +124,7 @@ math/tan.cl
 math/tanh.cl
 math/tgamma.cl
 misc/shuffle.cl
+misc/shuffle2.cl
 relational/all.cl
 relational/any.cl
 relational/bitselect.cl
@@ -140,7 +141,6 @@ relational/isnormal.cl
 relational/isnotequal.cl
 relational/isordered.cl
 relational/isunordered.cl
-relational/shuffle2.cl
 relational/signbit.cl
 shared/clamp.cl
 shared/max.cl

Added: libclc/trunk/generic/lib/misc/shuffle2.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/misc/shuffle2.cl?rev=312404=auto
==
--- libclc/trunk/generic/lib/misc/shuffle2.cl (added)
+++ libclc/trunk/generic/lib/misc/shuffle2.cl Fri Sep  1 19:23:28 2017
@@ -0,0 +1,160 @@
+//===-- generic/lib/misc/shuffle2.cl --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under both the University of Illinois Open Source
+// License and the MIT license. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include 
+
+#define 

[libclc] r312403 - relational: Implement shuffle builtin

2017-09-01 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Fri Sep  1 19:23:26 2017
New Revision: 312403

URL: http://llvm.org/viewvc/llvm-project?rev=312403=rev
Log:
relational: Implement shuffle builtin

This was added in CL 1.1

Tested with a Radeon HD 7850 (Pitcairn) using the CL CTS via:
test_conformance/relationals/test_relationals shuffle_built_in

v2: Add half-precision support to shuffle when available.
Move to misc/ and add section 6.12.12 to clc.h

Signed-off-by: Aaron Watry 
Reviewed-by: Jan Vesely 

Added:
libclc/trunk/generic/include/clc/misc/
libclc/trunk/generic/include/clc/misc/shuffle.h
libclc/trunk/generic/lib/misc/
libclc/trunk/generic/lib/misc/shuffle.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=312403=312402=312403=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep  1 19:23:26 2017
@@ -237,6 +237,9 @@
 
 /* 6.11.13 Image Read and Write Functions */
 
+/* 6.12.12 Miscellaneous Vector Functions */
+#include 
+
 #include 
 #include 
 

Added: libclc/trunk/generic/include/clc/misc/shuffle.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/misc/shuffle.h?rev=312403=auto
==
--- libclc/trunk/generic/include/clc/misc/shuffle.h (added)
+++ libclc/trunk/generic/include/clc/misc/shuffle.h Fri Sep  1 19:23:26 2017
@@ -0,0 +1,47 @@
+//===-- generic/include/clc/misc/shuffle.h --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under both the University of Illinois Open Source
+// License and the MIT license. See LICENSE.TXT for details.
+//
+//===--===//
+
+#define _CLC_SHUFFLE_DECL(TYPE, MASKTYPE, RETTYPE) \
+  _CLC_OVERLOAD _CLC_DECL RETTYPE shuffle(TYPE x, MASKTYPE mask);
+
+//Return type is same base type as the input type, with the same vector size 
as the mask.
+//Elements in the mask must be the same size (number of bits) as the input 
value.
+//E.g. char8 ret = shuffle(char2 x, uchar8 mask);
+
+#define _CLC_VECTOR_SHUFFLE_MASKSIZE(INBASE, INTYPE, MASKTYPE) \
+  _CLC_SHUFFLE_DECL(INTYPE, MASKTYPE##2, INBASE##2) \
+  _CLC_SHUFFLE_DECL(INTYPE, MASKTYPE##4, INBASE##4) \
+  _CLC_SHUFFLE_DECL(INTYPE, MASKTYPE##8, INBASE##8) \
+  _CLC_SHUFFLE_DECL(INTYPE, MASKTYPE##16, INBASE##16) \
+
+#define _CLC_VECTOR_SHUFFLE_INSIZE(TYPE, MASKTYPE) \
+  _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, TYPE##2, MASKTYPE) \
+  _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, TYPE##4, MASKTYPE) \
+  _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, TYPE##8, MASKTYPE) \
+  _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, TYPE##16, MASKTYPE) \
+
+_CLC_VECTOR_SHUFFLE_INSIZE(char, uchar)
+_CLC_VECTOR_SHUFFLE_INSIZE(short, ushort)
+_CLC_VECTOR_SHUFFLE_INSIZE(int, uint)
+_CLC_VECTOR_SHUFFLE_INSIZE(long, ulong)
+_CLC_VECTOR_SHUFFLE_INSIZE(uchar, uchar)
+_CLC_VECTOR_SHUFFLE_INSIZE(ushort, ushort)
+_CLC_VECTOR_SHUFFLE_INSIZE(uint, uint)
+_CLC_VECTOR_SHUFFLE_INSIZE(ulong, ulong)
+_CLC_VECTOR_SHUFFLE_INSIZE(float, uint)
+#ifdef cl_khr_fp64
+_CLC_VECTOR_SHUFFLE_INSIZE(double, ulong)
+#endif
+#ifdef cl_khr_fp16
+_CLC_VECTOR_SHUFFLE_INSIZE(half, ushort)
+#endif
+
+#undef _CLC_SHUFFLE_DECL
+#undef _CLC_VECTOR_SHUFFLE_MASKSIZE
+#undef _CLC_VECTOR_SHUFFLE_INSIZE

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=312403=312402=312403=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Sep  1 19:23:26 2017
@@ -123,6 +123,7 @@ math/sqrt.cl
 math/tan.cl
 math/tanh.cl
 math/tgamma.cl
+misc/shuffle.cl
 relational/all.cl
 relational/any.cl
 relational/bitselect.cl
@@ -139,6 +140,7 @@ relational/isnormal.cl
 relational/isnotequal.cl
 relational/isordered.cl
 relational/isunordered.cl
+relational/shuffle2.cl
 relational/signbit.cl
 shared/clamp.cl
 shared/max.cl

Added: libclc/trunk/generic/lib/misc/shuffle.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/misc/shuffle.cl?rev=312403=auto
==
--- libclc/trunk/generic/lib/misc/shuffle.cl (added)
+++ libclc/trunk/generic/lib/misc/shuffle.cl Fri Sep  1 19:23:26 2017
@@ -0,0 +1,157 @@
+//===-- generic/lib/misc/shuffle.cl --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under both the University of Illinois Open Source
+// License and the MIT license. See LICENSE.TXT for details.
+//

[libclc] r312402 - Add halfN types and enable fp16 when generating builtin declarations

2017-09-01 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Fri Sep  1 19:23:16 2017
New Revision: 312402

URL: http://llvm.org/viewvc/llvm-project?rev=312402=rev
Log:
Add halfN types and enable fp16 when generating builtin declarations

Uses the same mechanism to enable fp16 as we use for fp64 when
processing clc.h

Signed-off-by: Aaron Watry 
Reviewed-by: Jan Vesely 

Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/include/clc/clctypes.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=312402=312401=312402=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep  1 19:23:16 2017
@@ -8,6 +8,10 @@
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 #endif
 
+#ifdef cl_khr_fp16
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+#endif
+
 /* Function Attributes */
 #include 
 

Modified: libclc/trunk/generic/include/clc/clctypes.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clctypes.h?rev=312402=312401=312402=diff
==
--- libclc/trunk/generic/include/clc/clctypes.h (original)
+++ libclc/trunk/generic/include/clc/clctypes.h Fri Sep  1 19:23:16 2017
@@ -85,3 +85,11 @@ typedef __attribute__((ext_vector_type(4
 typedef __attribute__((ext_vector_type(8))) double double8;
 typedef __attribute__((ext_vector_type(16))) double double16;
 #endif
+
+#ifdef cl_khr_fp16
+typedef __attribute__((ext_vector_type(2))) half half2;
+typedef __attribute__((ext_vector_type(3))) half half3;
+typedef __attribute__((ext_vector_type(4))) half half4;
+typedef __attribute__((ext_vector_type(8))) half half8;
+typedef __attribute__((ext_vector_type(16))) half half16;
+#endif


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] r295920 - math: Add native_tan as wrapper to tan

2017-02-22 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Wed Feb 22 19:46:57 2017
New Revision: 295920

URL: http://llvm.org/viewvc/llvm-project?rev=295920=rev
Log:
math: Add native_tan as wrapper to tan

Trivially define native_tan as a redirect to tan.

If there are any targets with a native implementation, we can deal with it 
later.

Signed-off-by: Aaron Watry 
Reviewed-by: Matt Arsenault 

Added:
libclc/trunk/generic/include/clc/math/native_tan.h
Modified:
libclc/trunk/generic/include/clc/clc.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=295920=295919=295920=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Wed Feb 22 19:46:57 2017
@@ -103,6 +103,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* 6.11.2.1 Floating-point macros */

Added: libclc/trunk/generic/include/clc/math/native_tan.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_tan.h?rev=295920=auto
==
--- libclc/trunk/generic/include/clc/math/native_tan.h (added)
+++ libclc/trunk/generic/include/clc/math/native_tan.h Wed Feb 22 19:46:57 2017
@@ -0,0 +1,10 @@
+//===-- generic/include/clc/math/native_tan.h 
-===//
+
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under both the University of Illinois Open Source
+// License and the MIT license. See LICENSE.TXT for details.
+//
+//===--===//
+#define native_tan tan


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] r292335 - math: Add logb builtin

2017-01-17 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Tue Jan 17 21:14:10 2017
New Revision: 292335

URL: http://llvm.org/viewvc/llvm-project?rev=292335=rev
Log:
math: Add logb builtin

Ported from the amd-builtins branch.

Signed-off-by: Aaron Watry 
Reviewed-by: Matt Arsenault 
CC: Tom Stellard 

Added:
libclc/trunk/generic/include/clc/math/logb.h
libclc/trunk/generic/include/clc/math/logb.inc
libclc/trunk/generic/lib/math/logb.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=292335=292334=292335=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Jan 17 21:14:10 2017
@@ -76,6 +76,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Added: libclc/trunk/generic/include/clc/math/logb.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/logb.h?rev=292335=auto
==
--- libclc/trunk/generic/include/clc/math/logb.h (added)
+++ libclc/trunk/generic/include/clc/math/logb.h Tue Jan 17 21:14:10 2017
@@ -0,0 +1,2 @@
+#define __CLC_BODY 
+#include 

Added: libclc/trunk/generic/include/clc/math/logb.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/logb.inc?rev=292335=auto
==
--- libclc/trunk/generic/include/clc/math/logb.inc (added)
+++ libclc/trunk/generic/include/clc/math/logb.inc Tue Jan 17 21:14:10 2017
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE logb(__CLC_GENTYPE a);

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=292335=292334=292335=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Tue Jan 17 21:14:10 2017
@@ -104,6 +104,7 @@ math/log.cl
 math/log10.cl
 math/log1p.cl
 math/log2.cl
+math/logb.cl
 math/mad.cl
 math/modf.cl
 math/native_log.cl

Added: libclc/trunk/generic/lib/math/logb.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/logb.cl?rev=292335=auto
==
--- libclc/trunk/generic/lib/math/logb.cl (added)
+++ libclc/trunk/generic/lib/math/logb.cl Tue Jan 17 21:14:10 2017
@@ -0,0 +1,31 @@
+#include 
+#include "math.h"
+#include "../clcmacro.h"
+
+_CLC_OVERLOAD _CLC_DEF float logb(float x) {
+int ax = as_int(x) & EXSIGNBIT_SP32;
+float s = -118 - clz(ax);
+float r = (ax >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32;
+r = ax >= PINFBITPATT_SP32 ? as_float(ax) : r;
+r = ax < 0x0080 ? s : r;
+r = ax == 0 ? as_float(NINFBITPATT_SP32) : r;
+return r;
+}
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, logb, float);
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+_CLC_OVERLOAD _CLC_DEF double logb(double x) {
+long ax = as_long(x) & EXSIGNBIT_DP64;
+double s = -1011L - clz(ax);
+double r = (int) (ax >> EXPSHIFTBITS_DP64) - EXPBIAS_DP64;
+r = ax >= PINFBITPATT_DP64 ? as_double(ax) : r;
+r = ax < 0x0010L ? s : r;
+r = ax == 0L ? as_double(NINFBITPATT_DP64) : r;
+return r;
+}
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, logb, double)
+#endif


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] r292334 - math: Add expm1 builtin function

2017-01-17 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Tue Jan 17 21:13:37 2017
New Revision: 292334

URL: http://llvm.org/viewvc/llvm-project?rev=292334=rev
Log:
math: Add expm1 builtin function

Ported from the amd-builtins branch.

Signed-off-by: Aaron Watry 
Reviewed-by: Matt Arsenault 
CC: Tom Stellard 

Added:
libclc/trunk/generic/include/clc/math/expm1.h
libclc/trunk/generic/lib/math/expm1.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES
libclc/trunk/generic/lib/math/tables.cl
libclc/trunk/generic/lib/math/tables.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=292334=292333=292334=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Jan 17 21:13:37 2017
@@ -53,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Added: libclc/trunk/generic/include/clc/math/expm1.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/expm1.h?rev=292334=auto
==
--- libclc/trunk/generic/include/clc/math/expm1.h (added)
+++ libclc/trunk/generic/include/clc/math/expm1.h Tue Jan 17 21:13:37 2017
@@ -0,0 +1,9 @@
+#undef exp
+
+#define __CLC_BODY 
+#define __CLC_FUNCTION expm1
+
+#include 
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=292334=292333=292334=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Tue Jan 17 21:13:37 2017
@@ -83,6 +83,7 @@ math/erf.cl
 math/erfc.cl
 math/exp.cl
 math/exp_helper.cl
+math/expm1.cl
 math/exp2.cl
 math/exp10.cl
 math/fdim.cl

Added: libclc/trunk/generic/lib/math/expm1.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/expm1.cl?rev=292334=auto
==
--- libclc/trunk/generic/lib/math/expm1.cl (added)
+++ libclc/trunk/generic/lib/math/expm1.cl Tue Jan 17 21:13:37 2017
@@ -0,0 +1,142 @@
+#include 
+
+#include "math.h"
+#include "tables.h"
+#include "../clcmacro.h"
+
+/* Refer to the exp routine for the underlying algorithm */
+
+_CLC_OVERLOAD _CLC_DEF float expm1(float x) {
+const float X_MAX = 0x1.62e42ep+6f; // 128*log2 : 88.722839111673
+const float X_MIN = -0x1.9d1da0p+6f; // -149*log2 : -103.27892990343184
+
+const float R_64_BY_LOG2 = 0x1.715476p+6f; // 64/log2 : 
92.332482616893657
+const float R_LOG2_BY_64_LD = 0x1.62p-7f;  // log2/64 lead: 
0.0108032227
+const float R_LOG2_BY_64_TL = 0x1.c85fdep-16f; // log2/64 tail: 
0.272020388
+
+uint xi = as_uint(x);
+int n = (int)(x * R_64_BY_LOG2);
+float fn = (float)n;
+
+int j = n & 0x3f;
+int m = n >> 6;
+
+float r = mad(fn, -R_LOG2_BY_64_TL, mad(fn, -R_LOG2_BY_64_LD, x));
+
+// Truncated Taylor series
+float z2 = mad(r*r, mad(r, mad(r, 0x1.56p-5f,  0x1.56p-3f), 0.5f), 
r);
+
+float m2 = as_float((m + EXPBIAS_SP32) << EXPSHIFTBITS_SP32);
+float2 tv = USE_TABLE(exp_tbl_ep, j);
+
+float two_to_jby64_h = tv.s0 * m2;
+float two_to_jby64_t = tv.s1 * m2;
+float two_to_jby64 = two_to_jby64_h + two_to_jby64_t;
+
+z2 = mad(z2, two_to_jby64, two_to_jby64_t) + (two_to_jby64_h - 1.0f);
+   //Make subnormals work
+z2 = x == 0.f ? x : z2;
+z2 = x < X_MIN | m < -24 ? -1.0f : z2;
+z2 = x > X_MAX ? as_float(PINFBITPATT_SP32) : z2;
+z2 = isnan(x) ? x : z2;
+
+return z2;
+}
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, expm1, float)
+
+#ifdef cl_khr_fp64
+
+#include "exp_helper.h"
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+_CLC_OVERLOAD _CLC_DEF double expm1(double x) {
+const double max_expm1_arg = 709.8;
+const double min_expm1_arg = -37.42994775023704;
+const double log_OnePlus_OneByFour = 0.22314355131420976;   
//0x3FCC8FF7C79A9A22 = log(1+1/4)
+const double log_OneMinus_OneByFour = -0.28768207245178096; 
//0xBFD269621134DB93 = log(1-1/4)
+const double sixtyfour_by_lnof2 = 92.33248261689366;
//0x40571547652b82fe
+const double lnof2_by_64_head = 0.010830424696223417;   
//0x3f862e42fefa
+const double lnof2_by_64_tail = 2.5728046223276688e-14; 
//0x3d1cf79abc9e3b39
+
+// First, assume log(1-1/4) < x < log(1+1/4) i.e  -0.28768 < x < 0.22314
+double u = as_double(as_ulong(x) & 0xff00UL);
+double v = x - u;
+double y = u * u * 0.5;
+double z = v * (x + u) * 0.5;
+
+double q = fma(x,
+  fma(x,
+  fma(x,
+ 

[libclc] r281566 - math: Implement tgamma

2016-09-14 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Wed Sep 14 19:17:34 2016
New Revision: 281566

URL: http://llvm.org/viewvc/llvm-project?rev=281566=rev
Log:
math: Implement tgamma

Signed-off-by: Aaron Watry 
Reviewed-by: Tom Stellard 

Added:
libclc/trunk/generic/include/clc/math/tgamma.h
libclc/trunk/generic/include/clc/math/tgamma.inc
libclc/trunk/generic/lib/math/tgamma.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=281566=281565=281566=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Wed Sep 14 19:17:34 2016
@@ -88,6 +88,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Added: libclc/trunk/generic/include/clc/math/tgamma.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/tgamma.h?rev=281566=auto
==
--- libclc/trunk/generic/include/clc/math/tgamma.h (added)
+++ libclc/trunk/generic/include/clc/math/tgamma.h Wed Sep 14 19:17:34 2016
@@ -0,0 +1,3 @@
+#define __CLC_BODY 
+#include 
+#undef __CLC_BODY

Added: libclc/trunk/generic/include/clc/math/tgamma.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/tgamma.inc?rev=281566=auto
==
--- libclc/trunk/generic/include/clc/math/tgamma.inc (added)
+++ libclc/trunk/generic/include/clc/math/tgamma.inc Wed Sep 14 19:17:34 2016
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE tgamma(__CLC_GENTYPE a);

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=281566=281565=281566=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Wed Sep 14 19:17:34 2016
@@ -119,6 +119,7 @@ math/clc_sqrt.cl
 math/sqrt.cl
 math/tan.cl
 math/tanh.cl
+math/tgamma.cl
 relational/all.cl
 relational/any.cl
 relational/bitselect.cl

Added: libclc/trunk/generic/lib/math/tgamma.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/tgamma.cl?rev=281566=auto
==
--- libclc/trunk/generic/lib/math/tgamma.cl (added)
+++ libclc/trunk/generic/lib/math/tgamma.cl Wed Sep 14 19:17:34 2016
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2016 Aaron Watry
+ * Copyright (c) 2014 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include 
+
+#include "math.h"
+#include "../clcmacro.h"
+
+_CLC_OVERLOAD _CLC_DEF float tgamma(float x) {
+const float pi = 3.1415926535897932384626433832795f;
+float ax = fabs(x);
+float lg = lgamma(ax);
+float g = exp(lg);
+
+if (x < 0.0f) {
+float z = sinpi(x);
+g = g * ax * z;
+g = pi / g;
+g = g == 0 ? as_float(PINFBITPATT_SP32) : g;
+g = z == 0 ? as_float(QNANBITPATT_SP32) : g;
+}
+
+return g;
+}
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, tgamma, float);
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+_CLC_OVERLOAD _CLC_DEF double tgamma(double x) {
+const double pi = 3.1415926535897932384626433832795;
+double ax = fabs(x);
+double lg = lgamma(ax);
+double g = exp(lg);
+
+if (x < 0.0) {
+double z = sinpi(x);
+g = g * ax * z;
+g = pi / g;
+g = g == 0 ? as_double(PINFBITPATT_DP64) : g;
+g = z == 0 ? as_double(QNANBITPATT_DP64) : g;
+}
+
+return g;
+}
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, 

[libclc] r281563 - Add ADDR_SPACE parameter to _CLC_V_V_VP_VECTORIZE

2016-09-14 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Wed Sep 14 19:17:22 2016
New Revision: 281563

URL: http://llvm.org/viewvc/llvm-project?rev=281563=rev
Log:
Add ADDR_SPACE parameter to _CLC_V_V_VP_VECTORIZE

This macro is currently unused, but I plan to use it shortly.

The previous form did casts of pointers without an address space, which
doesn't work so well for CL 1.x.

Signed-off-by: Aaron Watry 
Reviewed-by: Tom Stellard 

Modified:
libclc/trunk/generic/lib/clcmacro.h

Modified: libclc/trunk/generic/lib/clcmacro.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/clcmacro.h?rev=281563=281562=281563=diff
==
--- libclc/trunk/generic/lib/clcmacro.h (original)
+++ libclc/trunk/generic/lib/clcmacro.h Wed Sep 14 19:17:22 2016
@@ -109,26 +109,41 @@
   } \
 \
 
-#define _CLC_V_V_VP_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, 
ARG2_TYPE) \
-  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 *y) { \
-return (RET_TYPE##2)(FUNCTION(x.x, (ARG2_TYPE*)y), FUNCTION(x.y, 
(ARG2_TYPE*)y+1)); \
+#define _CLC_V_V_VP_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, 
ADDR_SPACE, ARG2_TYPE) \
+  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ADDR_SPACE ARG2_TYPE##2 *y) { \
+return (RET_TYPE##2)( \
+FUNCTION(x.x, (ARG2_TYPE*)y), \
+FUNCTION(x.y, (ADDR_SPACE ARG2_TYPE*)((ADDR_SPACE ARG2_TYPE*)y+1)) \
+); \
   } \
 \
-  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 *y) { \
-return (RET_TYPE##3)(FUNCTION(x.x, (ARG2_TYPE*)y), FUNCTION(x.y, 
(ARG2_TYPE*)y+1), \
- FUNCTION(x.z, (ARG2_TYPE*)y+2)); \
+  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ADDR_SPACE ARG2_TYPE##3 *y) { \
+return (RET_TYPE##3)( \
+FUNCTION(x.x, (ARG2_TYPE*)y), \
+FUNCTION(x.y, (ADDR_SPACE ARG2_TYPE*)((ADDR_SPACE ARG2_TYPE*)y+1)), \
+FUNCTION(x.z, (ADDR_SPACE ARG2_TYPE*)((ADDR_SPACE ARG2_TYPE*)y+2)) \
+); \
   } \
 \
-  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 *y) { \
-return (RET_TYPE##4)(FUNCTION(x.lo, (ARG2_TYPE##2*)y), FUNCTION(x.hi, 
(ARG2_TYPE##2*)((ARG2_TYPE*)y+2))); \
+  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ADDR_SPACE ARG2_TYPE##4 *y) { \
+return (RET_TYPE##4)( \
+FUNCTION(x.lo, (ARG2_TYPE##2*)y), \
+FUNCTION(x.hi, (ADDR_SPACE ARG2_TYPE##2*)((ADDR_SPACE ARG2_TYPE*)y+2)) 
\
+); \
   } \
 \
-  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 *y) { \
-return (RET_TYPE##8)(FUNCTION(x.lo, (ARG2_TYPE##4*)y), FUNCTION(x.hi, 
(ARG2_TYPE##4*)((ARG2_TYPE*)y+4))); \
+  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ADDR_SPACE ARG2_TYPE##8 *y) { \
+return (RET_TYPE##8)( \
+FUNCTION(x.lo, (ARG2_TYPE##4*)y), \
+FUNCTION(x.hi, (ADDR_SPACE ARG2_TYPE##4*)((ADDR_SPACE ARG2_TYPE*)y+4)) 
\
+); \
   } \
 \
-  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 *y) { \
-return (RET_TYPE##16)(FUNCTION(x.lo, (ARG2_TYPE##8*)y), FUNCTION(x.hi, 
(ARG2_TYPE##8*)((ARG2_TYPE*)y+8))); \
+  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ADDR_SPACE ARG2_TYPE##16 *y) 
{ \
+return (RET_TYPE##16)( \
+FUNCTION(x.lo, (ARG2_TYPE##8*)y), \
+FUNCTION(x.hi, (ADDR_SPACE ARG2_TYPE##8*)((ADDR_SPACE ARG2_TYPE*)y+8)) 
\
+); \
   }
 
 #define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, 
ARG2_TYPE) \


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] r281564 - math: Implement lgamma_r

2016-09-14 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Wed Sep 14 19:17:28 2016
New Revision: 281564

URL: http://llvm.org/viewvc/llvm-project?rev=281564=rev
Log:
math: Implement lgamma_r

Ported from the amd-builtins branch, which is itself based on the
Sun Microsystems implementation.

Signed-off-by: Aaron Watry 
Reviewed-by: Tom Stellard 

Added:
libclc/trunk/generic/include/clc/math/lgamma_r.h
libclc/trunk/generic/include/clc/math/lgamma_r.inc
libclc/trunk/generic/lib/math/lgamma_r.cl
libclc/trunk/generic/lib/math/lgamma_r.inc
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=281564=281563=281564=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Wed Sep 14 19:17:28 2016
@@ -69,6 +69,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Added: libclc/trunk/generic/include/clc/math/lgamma_r.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/lgamma_r.h?rev=281564=auto
==
--- libclc/trunk/generic/include/clc/math/lgamma_r.h (added)
+++ libclc/trunk/generic/include/clc/math/lgamma_r.h Wed Sep 14 19:17:28 2016
@@ -0,0 +1,2 @@
+#define __CLC_BODY 
+#include 

Added: libclc/trunk/generic/include/clc/math/lgamma_r.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/lgamma_r.inc?rev=281564=auto
==
--- libclc/trunk/generic/include/clc/math/lgamma_r.inc (added)
+++ libclc/trunk/generic/include/clc/math/lgamma_r.inc Wed Sep 14 19:17:28 2016
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE lgamma_r(__CLC_GENTYPE x, global 
__CLC_INTN *iptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE lgamma_r(__CLC_GENTYPE x, local 
__CLC_INTN *iptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE lgamma_r(__CLC_GENTYPE x, private 
__CLC_INTN *iptr);

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=281564=281563=281564=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Wed Sep 14 19:17:28 2016
@@ -97,6 +97,7 @@ math/hypot.cl
 math/ilogb.cl
 math/clc_ldexp.cl
 math/ldexp.cl
+math/lgamma_r.cl
 math/log.cl
 math/log10.cl
 math/log1p.cl

Added: libclc/trunk/generic/lib/math/lgamma_r.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/lgamma_r.cl?rev=281564=auto
==
--- libclc/trunk/generic/lib/math/lgamma_r.cl (added)
+++ libclc/trunk/generic/lib/math/lgamma_r.cl Wed Sep 14 19:17:28 2016
@@ -0,0 +1,11 @@
+#include 
+
+#include "../clcmacro.h"
+#include "math.h"
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
+#define __CLC_BODY 
+#include 

Added: libclc/trunk/generic/lib/math/lgamma_r.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/lgamma_r.inc?rev=281564=auto
==
--- libclc/trunk/generic/lib/math/lgamma_r.inc (added)
+++ libclc/trunk/generic/lib/math/lgamma_r.inc Wed Sep 14 19:17:28 2016
@@ -0,0 +1,500 @@
+/*
+ * Copyright (c) 2014 Advanced Micro Devices, Inc.
+ * Copyright (c) 2016 Aaron Watry 
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#if __CLC_FPSIZE == 32
+#ifdef __CLC_SCALAR
+/*
+ * 
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights 

[libclc] r268708 - math: Add fdim implementation

2016-05-05 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Thu May  5 22:34:45 2016
New Revision: 268708

URL: http://llvm.org/viewvc/llvm-project?rev=268708=rev
Log:
math: Add fdim implementation

Based on the amd-builtin, but explicitly vectorized for all sizes (not just
float4), and includes a vectorized double implementation.

Passes piglit (float) tests on pitcairn.

Signed-off-by: Aaron Watry 
Reviewed-by: Jan Vesely 

Added:
libclc/trunk/generic/include/clc/math/fdim.h
libclc/trunk/generic/include/clc/math/fdim.inc
libclc/trunk/generic/lib/math/fdim.cl
libclc/trunk/generic/lib/math/fdim.inc
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=268708=268707=268708=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Thu May  5 22:34:45 2016
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Added: libclc/trunk/generic/include/clc/math/fdim.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/fdim.h?rev=268708=auto
==
--- libclc/trunk/generic/include/clc/math/fdim.h (added)
+++ libclc/trunk/generic/include/clc/math/fdim.h Thu May  5 22:34:45 2016
@@ -0,0 +1,2 @@
+#define __CLC_BODY 
+#include 

Added: libclc/trunk/generic/include/clc/math/fdim.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/fdim.inc?rev=268708=auto
==
--- libclc/trunk/generic/include/clc/math/fdim.inc (added)
+++ libclc/trunk/generic/include/clc/math/fdim.inc Thu May  5 22:34:45 2016
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fdim(__CLC_GENTYPE a, __CLC_GENTYPE b);

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=268708=268707=268708=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Thu May  5 22:34:45 2016
@@ -82,6 +82,7 @@ math/exp.cl
 math/exp_helper.cl
 math/exp2.cl
 math/exp10.cl
+math/fdim.cl
 math/fmax.cl
 math/fmin.cl
 math/fmod.cl

Added: libclc/trunk/generic/lib/math/fdim.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/fdim.cl?rev=268708=auto
==
--- libclc/trunk/generic/lib/math/fdim.cl (added)
+++ libclc/trunk/generic/lib/math/fdim.cl Thu May  5 22:34:45 2016
@@ -0,0 +1,10 @@
+#include 
+
+#include "math.h"
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
+#define __CLC_BODY 
+#include 

Added: libclc/trunk/generic/lib/math/fdim.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/fdim.inc?rev=268708=auto
==
--- libclc/trunk/generic/lib/math/fdim.inc (added)
+++ libclc/trunk/generic/lib/math/fdim.inc Thu May  5 22:34:45 2016
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014 Advanced Micro Devices, Inc.
+ * Copyright (c) 2016 Aaron Watry
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#if __CLC_FPSIZE == 32
+#ifdef __CLC_SCALAR
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fdim(__CLC_GENTYPE x, __CLC_GENTYPE y) {
+if (__builtin_isnan(x) || __builtin_isnan(y))
+return as_float(QNANBITPATT_SP32);
+return __builtin_fmax(x - y, 0);
+}
+#define __CLC_FDIM_VEC(width) \
+_CLC_OVERLOAD _CLC_DEF float##width fdim(float##width x, float##width y) { \
+/* Determine if x or y is NaN. */ \
+/* 

[libclc] r261714 - math: Fix ilogb(double) return type

2016-02-23 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Tue Feb 23 18:52:15 2016
New Revision: 261714

URL: http://llvm.org/viewvc/llvm-project?rev=261714=rev
Log:
math: Fix ilogb(double) return type

Signed-off-by: Aaron Watry 
Reviewed-by: Jan Vesely 

Modified:
libclc/trunk/generic/lib/math/ilogb.cl

Modified: libclc/trunk/generic/lib/math/ilogb.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/ilogb.cl?rev=261714=261713=261714=diff
==
--- libclc/trunk/generic/lib/math/ilogb.cl (original)
+++ libclc/trunk/generic/lib/math/ilogb.cl Tue Feb 23 18:52:15 2016
@@ -41,7 +41,7 @@ _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_
 #ifdef cl_khr_fp64
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 
-_CLC_OVERLOAD _CLC_DEF ilogb(double x) {
+_CLC_OVERLOAD _CLC_DEF int ilogb(double x) {
 ulong ux = as_ulong(x);
 ulong ax = ux & ~SIGNBIT_DP64;
 int r = (int) (ax >> EXPSHIFTBITS_DP64) - EXPBIAS_DP64;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] r261639 - math: Add ilogb ported from amd-builtins

2016-02-23 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Tue Feb 23 08:43:09 2016
New Revision: 261639

URL: http://llvm.org/viewvc/llvm-project?rev=261639=rev
Log:
math: Add ilogb ported from amd-builtins

The scalar float/double function bodies are a direct copy/paste
with usage of the CLC wrappers to vectorize them.

This commit also adds in the FP_ILOGB0 and FP_ILOGBNAN macros which are
equal to the results of ilogb(0.0f) and ilogb(float nan) respectively.

v2: Add FP_ILOGB0 and FP_ILOGBNAN definitions

Signed-off-by: Aaron Watry 
Reviewed-by: Jan Vesely 
v1 Reviewed-by: Tom Stellard 

Added:
libclc/trunk/generic/include/clc/math/ilogb.h
libclc/trunk/generic/include/clc/math/ilogb.inc
libclc/trunk/generic/lib/math/ilogb.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/include/clc/float/definitions.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=261639=261638=261639=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Feb 23 08:43:09 2016
@@ -62,6 +62,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: libclc/trunk/generic/include/clc/float/definitions.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/float/definitions.h?rev=261639=261638=261639=diff
==
--- libclc/trunk/generic/include/clc/float/definitions.h (original)
+++ libclc/trunk/generic/include/clc/float/definitions.h Tue Feb 23 08:43:09 
2016
@@ -14,6 +14,9 @@
 #define FLT_MIN 0x1.0p-126f
 #define FLT_EPSILON 0x1.0p-23f
 
+#define FP_ILOGB0 (-2147483647 - 1)
+#define FP_ILOGBNAN (-2147483647 - 1)
+
 #define M_E_F   0x1.5bf0a8p+1f
 #define M_LOG2E_F   0x1.715476p+0f
 #define M_LOG10E_F  0x1.bcb7b2p-2f

Added: libclc/trunk/generic/include/clc/math/ilogb.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/ilogb.h?rev=261639=auto
==
--- libclc/trunk/generic/include/clc/math/ilogb.h (added)
+++ libclc/trunk/generic/include/clc/math/ilogb.h Tue Feb 23 08:43:09 2016
@@ -0,0 +1,5 @@
+#define __CLC_BODY 
+
+#include 
+
+#undef __CLC_BODY

Added: libclc/trunk/generic/include/clc/math/ilogb.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/ilogb.inc?rev=261639=auto
==
--- libclc/trunk/generic/include/clc/math/ilogb.inc (added)
+++ libclc/trunk/generic/include/clc/math/ilogb.inc Tue Feb 23 08:43:09 2016
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_INTN ilogb(__CLC_GENTYPE x);

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=261639=261638=261639=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Tue Feb 23 08:43:09 2016
@@ -90,6 +90,7 @@ math/frexp.cl
 math/half_rsqrt.cl
 math/half_sqrt.cl
 math/hypot.cl
+math/ilogb.cl
 math/clc_ldexp.cl
 math/ldexp.cl
 math/log.cl

Added: libclc/trunk/generic/lib/math/ilogb.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/ilogb.cl?rev=261639=auto
==
--- libclc/trunk/generic/lib/math/ilogb.cl (added)
+++ libclc/trunk/generic/lib/math/ilogb.cl Tue Feb 23 08:43:09 2016
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015 Advanced Micro Devices, Inc.
+ * Copyright (c) 2016 Aaron Watry
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 

[libclc] r260114 - math: Add frexp ported from amd-builtins

2016-02-08 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Mon Feb  8 11:07:21 2016
New Revision: 260114

URL: http://llvm.org/viewvc/llvm-project?rev=260114=rev
Log:
math: Add frexp ported from amd-builtins

The float implementation is almost a direct port from the amd-builtins,
but instead of just having a scalar and float4 implementation, it has
a scalar and arbitrary width vector implementation.

The double scalar is also a direct port from AMD's builtin release.

The double vector implementation copies the logic in the float vector
implementation using the values from the double scalar version.

Both have been tested in piglit using tests sent to that project's
mailing list.

Signed-off-by: Aaron Watry 
Reviewed-by: Jan Vesely 

Added:
libclc/trunk/generic/include/clc/math/frexp.h
libclc/trunk/generic/include/clc/math/frexp.inc
libclc/trunk/generic/lib/math/frexp.cl
libclc/trunk/generic/lib/math/frexp.inc
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/include/clc/math/gentype.inc
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=260114=260113=260114=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Mon Feb  8 11:07:21 2016
@@ -58,6 +58,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Added: libclc/trunk/generic/include/clc/math/frexp.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/frexp.h?rev=260114=auto
==
--- libclc/trunk/generic/include/clc/math/frexp.h (added)
+++ libclc/trunk/generic/include/clc/math/frexp.h Mon Feb  8 11:07:21 2016
@@ -0,0 +1,2 @@
+#define __CLC_BODY 
+#include 

Added: libclc/trunk/generic/include/clc/math/frexp.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/frexp.inc?rev=260114=auto
==
--- libclc/trunk/generic/include/clc/math/frexp.inc (added)
+++ libclc/trunk/generic/include/clc/math/frexp.inc Mon Feb  8 11:07:21 2016
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE frexp(__CLC_GENTYPE x, global __CLC_INTN 
*iptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE frexp(__CLC_GENTYPE x, local __CLC_INTN 
*iptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE frexp(__CLC_GENTYPE x, private 
__CLC_INTN *iptr);

Modified: libclc/trunk/generic/include/clc/math/gentype.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/gentype.inc?rev=260114=260113=260114=diff
==
--- libclc/trunk/generic/include/clc/math/gentype.inc (original)
+++ libclc/trunk/generic/include/clc/math/gentype.inc Mon Feb  8 11:07:21 2016
@@ -2,38 +2,50 @@
 #define __CLC_FPSIZE 32
 
 #define __CLC_GENTYPE float
+#define __CLC_INTN int
 #define __CLC_SCALAR
 #include __CLC_BODY
 #undef __CLC_GENTYPE
+#undef __CLC_INTN
 #undef __CLC_SCALAR
 
 #define __CLC_GENTYPE float2
 #define __CLC_INTN int2
+#define __CLC_VECSIZE 2
 #include __CLC_BODY
+#undef __CLC_VECSIZE
 #undef __CLC_GENTYPE
 #undef __CLC_INTN
 
 #define __CLC_GENTYPE float3
 #define __CLC_INTN int3
+#define __CLC_VECSIZE 3
 #include __CLC_BODY
+#undef __CLC_VECSIZE
 #undef __CLC_GENTYPE
 #undef __CLC_INTN
 
 #define __CLC_GENTYPE float4
 #define __CLC_INTN int4
+#define __CLC_VECSIZE 4
 #include __CLC_BODY
+#undef __CLC_VECSIZE
 #undef __CLC_GENTYPE
 #undef __CLC_INTN
 
 #define __CLC_GENTYPE float8
 #define __CLC_INTN int8
+#define __CLC_VECSIZE 8
 #include __CLC_BODY
+#undef __CLC_VECSIZE
 #undef __CLC_GENTYPE
 #undef __CLC_INTN
 
 #define __CLC_GENTYPE float16
 #define __CLC_INTN int16
+#define __CLC_VECSIZE 16
 #include __CLC_BODY
+#undef __CLC_VECSIZE
 #undef __CLC_GENTYPE
 #undef __CLC_INTN
 
@@ -47,37 +59,49 @@
 
 #define __CLC_SCALAR
 #define __CLC_GENTYPE double
+#define __CLC_INTN int
 #include __CLC_BODY
 #undef __CLC_GENTYPE
+#undef __CLC_INTN
 #undef __CLC_SCALAR
 
 #define __CLC_GENTYPE double2
 #define __CLC_INTN int2
+#define __CLC_VECSIZE 2
 #include __CLC_BODY
+#undef __CLC_VECSIZE
 #undef __CLC_GENTYPE
 #undef __CLC_INTN
 
 #define __CLC_GENTYPE double3
 #define __CLC_INTN int3
+#define __CLC_VECSIZE 3
 #include __CLC_BODY
+#undef __CLC_VECSIZE
 #undef __CLC_GENTYPE
 #undef __CLC_INTN
 
 #define __CLC_GENTYPE double4
 #define __CLC_INTN int4
+#define __CLC_VECSIZE 4
 #include __CLC_BODY
+#undef __CLC_VECSIZE
 #undef __CLC_GENTYPE
 #undef __CLC_INTN
 
 #define __CLC_GENTYPE double8
 #define __CLC_INTN int8
+#define __CLC_VECSIZE 8
 #include __CLC_BODY
+#undef __CLC_VECSIZE
 #undef __CLC_GENTYPE
 #undef __CLC_INTN
 
 #define __CLC_GENTYPE double16
 #define __CLC_INTN int16
+#define 

[libclc] r249445 - integer: remove explicit casts from _MIN definitions

2015-10-06 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Tue Oct  6 14:12:12 2015
New Revision: 249445

URL: http://llvm.org/viewvc/llvm-project?rev=249445=rev
Log:
integer: remove explicit casts from _MIN definitions

The spec says (section 6.12.3, CL version 1.2):
  The macro names given in the following list must use the values
  specified. The values shall all be constant expressions suitable
  for use in #if preprocessing directives.

This commit addresses the second part of that statement.

Reviewed-by: Jan Vesely 
Reviewed-by: Tom Stellard 
CC: Moritz Pflanzer 
CC: Serge Martin 

Modified:
libclc/trunk/generic/include/clc/integer/definitions.h

Modified: libclc/trunk/generic/include/clc/integer/definitions.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/integer/definitions.h?rev=249445=249444=249445=diff
==
--- libclc/trunk/generic/include/clc/integer/definitions.h (original)
+++ libclc/trunk/generic/include/clc/integer/definitions.h Tue Oct  6 14:12:12 
2015
@@ -1,14 +1,14 @@
 #define CHAR_BIT 8
 #define INT_MAX 2147483647
-#define INT_MIN ((int)(-2147483647 - 1))
+#define INT_MIN (-2147483647 - 1)
 #define LONG_MAX  0x7fffL
 #define LONG_MIN (-0x7fffL - 1)
 #define CHAR_MAX SCHAR_MAX
 #define CHAR_MIN SCHAR_MIN
 #define SCHAR_MAX 127
-#define SCHAR_MIN ((char)(-127 - 1))
+#define SCHAR_MIN (-127 - 1)
 #define SHRT_MAX 32767
-#define SHRT_MIN ((short)(-32767 - 1))
+#define SHRT_MIN (-32767 - 1)
 #define UCHAR_MAX 255
 #define USHRT_MAX 65535
 #define UINT_MAX 0x


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits