Commit Graph

154 Commits

Author SHA1 Message Date
Aaron Watry
9335fe8eff relational/signbit: Refactor to use relational macros
Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213317
2014-07-17 22:05:25 +00:00
Aaron Watry
d5aace4874 Fix isnan definition for vector results
Vector true is -1, not 1, which means we need to use the relational unary
macro instead of the normal unary builtin one.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213316
2014-07-17 22:05:22 +00:00
Aaron Watry
13116cf01a relational: create re-usable macros for relational declarations
relational.h includes relational macros for defining functions which need to
return 1 for scalar true and -1 for vector true.

I believe that this is the only place that this behavior is required, so the
macro is placed at its lowest useful level (same directory as it is used in).

This also creates re-usable unary/binary declaration and floatn includes which
should simplify relational builtin declarations.

Mostly patterned off of include/math/[binary_decl|unary_decl|floatn].inc
but with required changes for relational functions.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213315
2014-07-17 22:05:16 +00:00
Tom Stellard
8d92c396d9 prepare-builtins: Fix broken build due to recent LLVM API change
llvm-svn: 212470
2014-07-07 17:46:45 +00:00
Jeroen Ketema
575fb84cc3 OpenCL 1.1 does not define CL_VERSION_1_2 so use hardcoded number instead
Otherwise the test evaluates to true on OpenCL 1.1 and earlier. Since we
therefore cannot use the CL_VERSION_?_? macros move them to the proper
position in the top-level header.

llvm-svn: 211787
2014-06-26 15:26:38 +00:00
Aaron Watry
d7f158e006 relational: Fix signbit
The vector components were mistakenly using () instead of {}, which caused
all but the last vector component to be dropped on the floor.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Jeroen Ketema <j.ketema@imperial.ac.uk>
llvm-svn: 211733
2014-06-25 21:08:38 +00:00
Aaron Watry
d9ee196eab relational: Implement signbit
v2 Changes:
   - use __builtin_signbit instead of shifting by hand
   - significantly improve vector shuffling
   - Works correctly now for signbit(float16) on radeonsi

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 211696
2014-06-25 13:29:23 +00:00
Jeroen Ketema
42df5d2a8f Add exp10
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211680
2014-06-25 10:06:35 +00:00
Jeroen Ketema
dd1fbc0082 Add half limits
These are apparently only defined in OpenCL 1.2.

HALF_MAX, HALF_MIN and HALF_EPSILON are currently omitted. Clang does
not seem to support the ‘h’ suffix for half float constants even with
the cl_khr_fp16 extension enabled.

Reviewed-by: Tom Sellard <tom@stellard.net>
llvm-svn: 211579
2014-06-24 09:51:01 +00:00
Jeroen Ketema
046b47fbbe Introduce CLC_VERSION macros v2
Add these out-of-order in clc.h so we can use these in other headers.

v2: Take into account the lack of a definition in OpenCL 1.0

Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211578
2014-06-24 09:46:52 +00:00
Jeroen Ketema
985a1381b2 Add MAXFLOAT
Align definitions while we are here.

Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211577
2014-06-24 09:41:28 +00:00
Jeroen Ketema
526fe2d501 Move clcmacro.h to avoid cluttering user namespace v2
v2: - use quotes instead of <>
    - add include to r600/lib/math/nextafter.c changed

Reviewed-by: Tom Stellard <tom@stellard.net>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 211576
2014-06-24 09:36:32 +00:00
Jeroen Ketema
bfdb1c0c2f Protect functions taking double by #ifdef cl_khr_fp64
Also change the order of the functions to be consistent with
the order in the header files.

llvm-svn: 211496
2014-06-23 14:15:39 +00:00
Jeroen Ketema
d253e66ec7 Fix breakage after r211259
While we are here introduce the proper headers for the error code.

Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211432
2014-06-21 09:20:31 +00:00
Jeroen Ketema
09516fa27d Add pown
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211211
2014-06-18 19:42:23 +00:00
Jeroen Ketema
fdee0d3efe Add missing undefs
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211210
2014-06-18 19:37:34 +00:00
Aaron Watry
d9afe9def0 Fix definition of INFINITY and add NAN/HUGE_VAL[F]
v3: change __builtin_nanf() to __builtin_nanf("")
    This doesn't work yet, but it was agreed to commit as-is with the logic
    that "broken" is better than "completely missing" and this should be
    fixed in clang.

v2: use __builtin_inff() and also add nan/huge_val definitions

Signed-off-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 211065
2014-06-16 22:32:58 +00:00
Jeroen Ketema
f3bd08ae63 Add remaining float constants
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 211062
2014-06-16 22:15:50 +00:00
Aaron Watry
50f518be65 Revert "clctypes.h: Don't rely on stddef.h for size_t and ptrdiff_t"
This reverts commit 4cf021ae67b6ea8cfd42aa76ce6f5e1c329e145a.

llvm-svn: 211049
2014-06-16 20:21:19 +00:00
Aaron Watry
6af2969a61 math: Implement mix builtin
Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211047
2014-06-16 19:53:59 +00:00
Aaron Watry
f7f79d2a94 relational: Add isequal(floatN) builtin
Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211046
2014-06-16 19:53:57 +00:00
Aaron Watry
e167db9238 Add all(igentype) builtin
Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211045
2014-06-16 19:53:54 +00:00
Aaron Watry
c164fc384b clctypes.h: Don't rely on stddef.h for size_t and ptrdiff_t
llvm-svn: 211044
2014-06-16 19:53:52 +00:00
Jan Vesely
bd37b6884c Add intptr types
Based on clang's stdint.h

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 210933
2014-06-13 19:43:18 +00:00
Jeroen Ketema
e2a0f050d8 Add files forgotten in the previous commit
llvm-svn: 210896
2014-06-13 12:33:40 +00:00
Jeroen Ketema
82aaa41286 Implementations for exp(float) and exp(double) v2
Use separate implementations instead of a macro
to ensure the constant multiplied with is of
higher precision.

v2: Use the correct formula, spotted by Dan Liew <daniel.liew@imperial.ac.uk>

Reviewed-by: Aaron Warty <awatry@gmail.com>
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 210891
2014-06-13 09:40:09 +00:00
Tom Stellard
0ab103422d prepare-builtins: Use std:: prefix for error_code
This fixes the build with with newer LLVM.

llvm-svn: 210867
2014-06-13 01:30:14 +00:00
Jeroen Ketema
a3089bd7e5 Remove unused include which breaks build after r210803
Tested with llvm 3.4 and trunk.

llvm-svn: 210825
2014-06-12 21:10:17 +00:00
Jeroen Ketema
f3943efe17 Fix build broken by LLVM commit r209103
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 210111
2014-06-03 15:43:57 +00:00
Jeroen Ketema
75c1a0c6e2 Add more log related float constants
llvm-svn: 209850
2014-05-29 21:30:28 +00:00
Jeroen Ketema
d1bb82a722 Fix _F definitions
The 'f' was missing and, hence, the values were
considered to be doubles instead of floats.

Reviewed by: Tom Stellard

llvm-svn: 209849
2014-05-29 21:29:34 +00:00
Jeroen Ketema
a16fdbfac2 Add definition for M_PI
Reviewed by: Tom Stellard

llvm-svn: 209848
2014-05-29 21:24:57 +00:00
Tom Stellard
98dccb109b Fix build broken by LLVM commit r207593
llvm-svn: 207685
2014-04-30 18:35:20 +00:00
Tom Stellard
998602dac2 Remove clc/gentype.inc
This file duplicates clc/math/gentype.inc and is not
actually being used.

Patch by: Jeroen Ketema

llvm-svn: 207684
2014-04-30 18:35:17 +00:00
Tom Stellard
f83fe5a6dc Introduce M_LOG2E_F and M_LOG2E
Patch by: Jeroen Ketema

llvm-svn: 205055
2014-03-28 21:19:03 +00:00
Tom Stellard
ce43db105e Replace tabs by spaces
Patch by: Jeroen Ketema

llvm-svn: 205054
2014-03-28 21:19:00 +00:00
Tom Stellard
6378f7a5e2 Add definition for M_PI_F v3
v2:
  - Use a hexadecimal constant.

v3:
  - Use a hexadecimal constant in floating-point notation.

llvm-svn: 204666
2014-03-24 20:36:44 +00:00
Tom Stellard
3a12fc6a07 Add sincos
Patch by: Jeroen Ketema

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 204478
2014-03-21 16:22:01 +00:00
Tom Stellard
074e7a8ed0 Add cross for double3 and double4
Patch by: Jeroen Ketema

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 204477
2014-03-21 16:21:58 +00:00
Tom Stellard
7aee1cfa99 Fix build since r202052
sys::fs_F_Binary has been replaced with sys::fs_F_Text

llvm-svn: 202081
2014-02-24 21:31:56 +00:00
Tom Stellard
d873c8e05a Add generic nvptx targets
These do not import the code specific to nvidiacl

Patch by: Jeroen Ketema

llvm-svn: 201431
2014-02-14 20:33:53 +00:00
Tom Stellard
55d3746dbe Revert "Enforce python2 for systems that use python3 as their default."
This reverts commit r200413.

This was breaking the build on systems where the python 2.x executable
was called python.

llvm-svn: 201239
2014-02-12 14:54:17 +00:00
Tom Stellard
0d35ed912a Updated README.TXT with information about using DESTDIR and building with Ninja.
Patch by: Dan Liew

llvm-svn: 200416
2014-01-29 20:03:28 +00:00
Tom Stellard
8a3770ab97 Fixed rules names so they are unique when aliases are present.
This is necessary for building with Ninja because it does not allow
duplicate rule names.

Patch by: Dan Liew

llvm-svn: 200415
2014-01-29 20:03:27 +00:00
Tom Stellard
91d51db800 Fixed ninja build issues relating to use of $(DESTDIR)
We use ${DESTDIR} syntax now instead of $(DESTDIR) because that syntax
works both is the shell (at least it does for bash) and for make (at
least it does for GNU Make)

Patch By: Dan Liew

llvm-svn: 200414
2014-01-29 20:03:26 +00:00
Tom Stellard
ac0fb621ce Enforce python2 for systems that use python3 as their default.
Patch by: Dan Liew

llvm-svn: 200413
2014-01-29 20:03:24 +00:00
Tom Stellard
8a63b15b3c Fix build broken by LLVM commit r199279
Patch by: Udo van den Heuvel

Tom Stellard:
  - Added ifdef and error handling

llvm-svn: 199687
2014-01-20 20:28:48 +00:00
NAKAMURA Takumi
d40d387fb1 Update the copyright credits -- Happy new year 2014!
FIXME: Dragonegg may be updated at non-trivial changes.
llvm-svn: 198274
2014-01-01 08:27:31 +00:00
Aaron Watry
8ef48d07ef Pass -fno-builtin flag to clang to silence warnings
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 198168
2013-12-29 16:39:55 +00:00
Aaron Watry
b38037f7b7 Fix build with LLVM 3.5
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 198167
2013-12-29 16:39:53 +00:00