summaryrefslogtreecommitdiffstats
path: root/libclc/generic/include/clc/integer
Commit message (Collapse)AuthorAgeFilesLines
* integer/gentype: Add __CLC_VECSIZE macroJan Vesely2018-03-081-0/+96
| | | | | | Reviewer: Aaron Watry <awatry@gmail.com> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 327043
* popcount: Provide function implementation rather than intrinsic redirectJan Vesely2018-03-083-26/+6
| | | | | | | | amdgcn will need to override this Reviewer: Aaron Watry <awatry@gmail.com> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 327042
* integer: Add popcount implementation using ctpop intrinsicAaron Watry2017-09-092-0/+26
| | | | | | | | | | | | | 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 <awatry@gmail.com> Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 312854
* integer: remove explicit casts from _MIN definitionsAaron Watry2015-10-061-3/+3
| | | | | | | | | | | | | | | 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 <jan.vesely@rutgers.edu> Reviewed-by: Tom Stellard <tom@stellard.net> CC: Moritz Pflanzer <moritz.pflanzer14@imperial.ac.uk> CC: Serge Martin <edb+libclc@sigluy.net> llvm-svn: 249445
* integer: Update integer limits to comply with specAaron Watry2015-09-151-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | The values for the char/short/integer/long minimums were declared with their actual values, not the definitions from the CL spec (v1.1). As a result, (-2147483648) was actually being treated as a long by the compiler, not an int, which caused issues when trying to add/subtract that value from a vector. Update the definitions to use the values declared by the spec, and also add explicit casts for the char/short/int minimums so that the compiler actually treats them as shorts/chars. Without those casts, they actually end up stored as integers, and the compiler may end up storing the INT_MIN as a long. The compiler can sign extend the values if it needs to convert the char->short, short->int, or int->long v2: Add explicit cast for INT_MIN and fix some type-o's and wrapping in the commit message. Reported-by: Moritz Pflanzer <moritz.pflanzer14@imperial.ac.uk> CC: Moritz Pflanzer <moritz.pflanzer14@imperial.ac.uk> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> Signed-off-by: Aaron Watry <awatry@gmail.com> llvm-svn: 247661
* Implement generic mad_satJan Vesely2014-09-022-0/+4
| | | | | | | | | | | | v2: Fix trailing whitespace Fix signed long overflow improve comment v3: fix typo Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewed-by: Tom Stellard <tom@stellard.net> llvm-svn: 216923
* Revert "Implement generic mad_sat"Aaron Watry2014-08-232-4/+0
| | | | | | | | This reverts commit cf62eded8b623a1c10d3692d25e5882b7939f564. I didn't mean to commit this... Jan has a v3 incoming llvm-svn: 216322
* Add int3/uint3 to integer-gentype.incAaron Watry2014-08-231-0/+8
| | | | | | | | These were missing and caused mad24/mul24 with int3/uint3 arg type to fail Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 216321
* Implement generic mad_satAaron Watry2014-08-232-0/+4
| | | | | | | | | v2: Fix trailing whitespace Fix signed long overflow improve comment Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu> llvm-svn: 216320
* Parenthesize arguments for mad_hiAaron Watry2013-09-091-1/+1
| | | | | | Thanks to Jordon Rose <jordan_rose@apple.com> for pointing this out. llvm-svn: 190310
* Implement mad_hi built-inAaron Watry2013-09-061-0/+1
| | | | | | | | | We already have a working mul_hi, and the spec gives us the implementation as: Returns mul_hi(a,b)+c. Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 190211
* Remove unneeded semi-colonsAaron Watry2013-09-051-6/+6
| | | | | Reviewed-By: Aaron Watry <awatry@gmail.com> llvm-svn: 190059
* Add mul_hi implementation [v2]Aaron Watry2013-08-192-0/+3
| | | | | | | | | | | | | | | Everything except long/ulong is handled by just casting to the next larger type, doing the math and then shifting/casting the result. For 64-bit types, we break the high/low parts of each operand apart, and do a FOIL-based multiplication. v2: Discard the stack-overflow implementation due to copyright concerns. - The implementation is still FOIL-based, but discards the previous code. Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 188684
* Add rhadd builtinAaron Watry2013-08-152-0/+3
| | | | | | | | | | | | rhadd = (x+y+1)>>1 Implemented as: (x>>1) + (y>>1) + ((x&1)|(y&1)) This prevents us having to do assembly addition and overflow detection Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 188477
* Add hadd builtinAaron Watry2013-08-152-0/+3
| | | | | | | | | | (x + y) >> 1 gets changed to: (x>>1) + (y>>1) + (x&y&1) Saves us having to do any llvm assembly and overflow checking in the addition. Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 188476
* Add missing integer min/max definitionsAaron Watry2013-07-261-0/+15
| | | | | | | | Found in CL 1.1 spec section 6.11.3 Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 187200
* Implement generic upsample()Aaron Watry2013-07-191-0/+25
| | | | | | | | | | | | | | 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> llvm-svn: 186691
* Add integer-gentype.inc: Missing file from r185839Tom Stellard2013-07-151-0/+39
| | | | llvm-svn: 186326
* Implement mad24() and mul24() builtinsTom Stellard2013-07-084-0/+8
| | | | | Reviewed-by: Aaron Watry <awatry@gmail.com> llvm-svn: 185839
* Add __CLC_ prefix to all macro definitions in headersTom Stellard2013-07-0813-445/+445
| | | | | | | | | | | 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> llvm-svn: 185838
* libclc: Implement clz() builtinTom Stellard2013-06-262-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 185004
* libclc: Implement the min(vec, scalar) version of the min builtin.Tom Stellard2013-06-261-0/+23
| | | | | | | | | | 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 llvm-svn: 185002
* Simplify rotate implementation a bit..Tom Stellard2013-06-261-0/+16
| | | | | | | | Much more understandable/readable as a result, and probably more efficient. Patch by: Aaron Watry llvm-svn: 184997
* libclc: implement rotate builtinTom Stellard2013-06-263-0/+14
| | | | | | | | | | | | 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 llvm-svn: 184996
* libclc: Move max builtin to shared/Tom Stellard2013-06-262-3/+0
| | | | | | | | Max(x,y) is available for all integer/floating types. Patch by: Aaron Watry llvm-svn: 184995
* libclc: Add max() builtin functionTom Stellard2013-06-262-0/+3
| | | | | | | | Adds this function for both int and floating data types. Patch by: Aaron Watry llvm-svn: 184992
* Implement sub_sat builtin. Patch by Lei Mou!Peter Collingbourne2012-08-052-0/+3
| | | | llvm-svn: 161312
* Initial commit.Peter Collingbourne2012-01-087-0/+394
llvm-svn: 147756
OpenPOWER on IntegriCloud