summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-07-22Merge branch 'master' into tstellar-masterHEADmasterTom Stellard27-312/+406
2013-07-19Implement generic upsample()Aaron Watry4-0/+61
Reduces all vector upsamples down to its scalar components, so probably not the most efficient thing in the world, but it does what the spec says it needs to do. Another possible implementation would be to convert/cast everything as unsigned if necessary, upsample the input vectors, create the upsampled value, and then cast back to signed if required. Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard at amd.com> git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@186691 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-18Fix build with LLVM 3.4Aaron Watry1-0/+5
F_Binary and friends were moved to include/Support/FileSystem.h v2: Maintain compatibility with LLVM 3.3 Signed-off-by: Aaron Watry <awatry@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@186610 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16Fix and re-enable R600 vload/vstore assemblyAaron Watry5-56/+233
The assembly optimizations were making unsafe assumptions about which address spaces had which identifiers. Also, fix vload/vstore with 64-bit pointers. This was broken previously on Radeon SI. This version still only has assembly versions of int/uint 2/4/8/16 for global loads and stores on R600, but it does it in a way that would be very easily extended to private/local/constant and could also be handled easily on other architectures. v2: 1) Leave v[load|store]_impl.ll in generic/lib 2) Remove vload_if.ll and vstore_if.ll interfaces 3) Fix address+offset calculations 3) Remove offset from assembly arg list git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@186416 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16libclc: vload/vstore disable assembly and fix offset calculationAaron Watry5-245/+20
This commit gets us back to pure CLC and fixes offset calculations. The next commit will re-enable the assembly implementation for R600, fix bugs related to 64-bit address spaces, and also fix the incorrect assumption that address space identifiers are the same in all architectures. git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@186415 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-15Add integer-gentype.inc: Missing file from r185839Tom Stellard1-0/+39
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@186326 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08Implement mad24() and mul24() builtinsTom Stellard10-0/+34
Reviewed-by: Aaron Watry <awatry@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185839 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08Add __CLC_ prefix to all macro definitions in headersTom Stellard75-712/+712
libclc was defining and undefing GENTYPE and several other macros with common names in its header files. This was preventing applications from defining macros with identical names as command line arguments to the compiler, because the definitions in the header files were masking the macros defined as compiler arguements. Reviewed-by: Aaron Watry <awatry@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185838 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08Implement barrier() builtinTom Stellard3-0/+29
Reviewed and Tested-by: Aaron Watry <awatry@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185837 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08Add bitselect() builtinTom Stellard2-0/+2
Reviewed-By: Aaron Watry <awatry@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185836 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Add __CLC_ prefix to all macro definitions in headersTom Stellard75-712/+712
libclc was defining and undefing GENTYPE and several other macros with common names in its header files. This was preventing applications from defining macros with identical names as command line arguments to the compiler, because the definitions in the header files were masking the macros defined as compiler arguements. Reviewed-by: Aaron Watry <awatry@gmail.com>
2013-06-26Implement barrier() builtinTom Stellard3-0/+29
Reviewed-by: Aaron Watry <awatry@gmail.com>
2013-06-26libclc: Add assembly versions of vstore for global [u]int4/8/16Tom Stellard4-6/+168
The assembly should be generic, but at least currently R600 only supports 32-bit stores of [u]int1/4, and I believe that only global is well-supported. R600 lowers the 8/16 component stores to multiple 4-component stores. The unoptimized C versions of the other stuff is left in place. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185009 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Add assembly versions of vload for global int4/8/16Tom Stellard4-2/+162
The assembly should be generic, but at least currently R600 only supports 32-bit loads of int1/4, and I believe that only global is well-supported. R600 lowers the 8/16 component vectors to multiple 4-bit loads. The unoptimized C versions of the other stuff is left in place. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185008 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Initial vstore implementationTom Stellard4-0/+94
Assumes that the target supports byte-addressable stores. Completely unoptimized. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185007 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Initial vload implementationTom Stellard4-0/+86
Should work for all targets and data types. Completely unoptimized. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185006 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26r600: Fix implementations of get_group_id.ll and get_local_size.llTom Stellard2-12/+12
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185005 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Implement clz() builtinTom Stellard7-0/+158
Squashed commit of the following: commit a0df0a0e86c55c1bdc0b9c0f5a739e5adef4b056 Author: Aaron Watry <awatry@gmail.com> Date: Mon Apr 15 18:42:04 2013 -0500 libclc: Rename clz.ll to clz_if.ll to ensure it gets built. configure.py treats files that have the same name with the .cl and .ll extensions as overriding eachother. E.g. If you have clz.cl and clz.ll both specified to be built in the same SOURCES file, only the first file listed will actually be built. Since the contents of clz.ll were an interface that is implemented in clz_impl.ll, rename clz.ll to clz_if.ll to make sure that the interface is built. commit 931b62bed05c58f737de625bd415af09571a6a5a Author: Aaron Watry <awatry@gmail.com> Date: Sat Apr 13 12:32:54 2013 -0500 libclc: llvm assembly implementation of clz Untested... currently crashes in the same manner as add_sat. commit 6ef0b7b0b6d2e5584086b4b9a9243743b2e0538f Author: Aaron Watry <awatry@gmail.com> Date: Sat Mar 23 12:35:27 2013 -0500 libclc: Add stub clz builtin For scalar int/uint, attempt to use the clz llvm builtin.. for all others return 0 until an actual implementation is finished. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185004 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Add clamp(vec, scalar, scalar) and max(vec, scalar)Tom Stellard4-0/+20
For any GENTYPE that isn't scalar, we need to implement a mixed vector/scalar version of clamp/max. This depends on the min() patches I sent to the list a few minutes ago. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185003 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Implement the min(vec, scalar) version of the min builtin.Tom Stellard4-0/+41
Checks if the current GENTYPE is scalar, and if not, then defines a separate implementation of the function which casts the second arg to vector before proceeding. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185002 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: implement initial version of min()Tom Stellard6-0/+22
This doesn't handle the integer cases for min(vector, scalar). Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185001 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Rename [add|sub]_sat.ll to [add|sub]_sat_if.llTom Stellard4-2/+4
configure.py allows overloading *.cl with *.ll, but will only ever build the first file listed in SOURCES of ${file}.cl and ${file}.ll add_sat, sub_sat, (and the soon to be submitted clz) all define interfaces in ${function_name}.ll which are implemented in ${function_name}_impl.ll. Renaming the interface files is enough to get them to build again, fixing CL usage of these functions. Tested on clover/r600g. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185000 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Add a another TODO note.Tom Stellard1-0/+3
Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184999 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Add a TODO note.Tom Stellard1-0/+4
Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184998 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Simplify rotate implementation a bit..Tom Stellard2-21/+37
Much more understandable/readable as a result, and probably more efficient. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184997 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: implement rotate builtinTom Stellard7-0/+55
This implementation does a lot of bit shifting and masking. Suffice to say, this is somewhat suboptimal... but it does look to produce correct results (after the piglit tests were corrected for sign extension issues). Someone who knows LLVM better than I could re-write this more efficiently. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184996 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Move max builtin to shared/Tom Stellard11-16/+10
Max(x,y) is available for all integer/floating types. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184995 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Add clamp() builtin for integer/floating pointTom Stellard6-0/+24
Created under a new shared/ directory for functions which are available for both integer and floating point types. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184994 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Fix abs_diff builtin integer functionTom Stellard2-1/+2
Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184993 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26libclc: Add max() builtin functionTom Stellard10-0/+28
Adds this function for both int and floating data types. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184992 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26configure: Enable building separate libraries for target variantsTom Stellard1-44/+73
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184991 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26configure: fix out-of-source buildTom Stellard1-2/+3
Patch by: Niels Ole Salscheider git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184990 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Fix build with LLVM 3.3Tom Stellard1-4/+4
Patch by: Niels Ole Salscheider git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184989 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Implement ceil() builtinTom Stellard2-0/+7
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184988 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Implement fmax() and fmin() builtinsTom Stellard9-0/+76
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184987 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Remove the static keyword from the _CLC_INLINE macroTom Stellard1-1/+1
static functions are not allowed in OpenCL C git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184986 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Use brackets around include files in length.cl and normalize.clTom Stellard2-2/+2
These functions were not being compiled git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184985 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Fix typo in include/clc/geometric/length.incTom Stellard1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184984 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26r600: Add overrides fileTom Stellard1-0/+2
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184983 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Allow targets to override generic implementationsTom Stellard1-0/+8
Targets can override generic implementations by adding a file called OVERRIDES in $(TARGET_DIR)/lib and listing the generic implementations that it wants to override. For example, to override get_group_id() and get_global_size() you would add these lines to the OVERRIDES file: workitem/get_group_id.cl workitem/get_global_size.cl git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184982 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Make libclc more Linux FHS conform.Tom Stellard1-14/+51
- First introducing a versioning scheme - Add --libexecdir, --includedir and --pkgconfigdir and prefill them as well as --prefix - Build all targets by default - Create clc.pc and install it in $pkgconfigdir - Use clang++ instead of c++ - Rename builtins.bc to built_libs/$triple.bc and install them in $libexecdir - Includes are installed recursively to $includedir - Finally add $(DESTDIR) for 'make install' Patch by: Johannes Obermayr git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184981 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26R600: Replace cl implementations with LLVM IR implementationTom Stellard7-22/+76
This allows libclc to be built for R600 with upstream clang and LLVM. git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184980 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26PTX: move implementations of work-item and synchronisation functionsTom Stellard2-2/+2
to lib, and add header files in generic. Incorporates a patch by Tom Stellard! git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184979 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26Move R600 headers into generic directoryTom Stellard9-18/+2
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184978 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26r600: Add get_global_size() implementationTom Stellard3-3/+12
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184977 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26r600: Fix get_global_id implementationTom Stellard1-3/+3
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184976 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26r600: Initial supportTom Stellard10-1/+30
This includes a get_global_id() implementation and function stubs for the other workitem and synchronization functions. git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184975 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24libclc: Add assembly versions of vstore for global [u]int4/8/16Aaron Watry4-6/+168
The assembly should be generic, but at least currently R600 only supports 32-bit stores of [u]int1/4, and I believe that only global is well-supported. R600 lowers the 8/16 component stores to multiple 4-component stores. The unoptimized C versions of the other stuff is left in place.
2013-05-24libclc: Add assembly versions of vload for global int4/8/16Aaron Watry4-2/+162
The assembly should be generic, but at least currently R600 only supports 32-bit loads of int1/4, and I believe that only global is well-supported. R600 lowers the 8/16 component vectors to multiple 4-bit loads. The unoptimized C versions of the other stuff is left in place.
2013-05-24libclc: Initial vstore implementationAaron Watry4-0/+94
Assumes that the target supports byte-addressable stores. Completely unoptimized.