Commit Graph

331 Commits

Author SHA1 Message Date
Dave Airlie c37145cab1 libclc: Add Mesa/SPIR-V target
Add targets to emit SPIR-V targeted to Mesa's OpenCL support, using
SPIR-V 1.1.

Substantially based on Dave Airlie's earlier work.

libclc: spirv: remove step/smoothstep apis not defined for SPIR-V

libclc: disable inlines for SPIR-V builds

Reviewed By: jvesely, tstellar, jenatali

Differential Revision: https://reviews.llvm.org/D77589
2020-08-17 14:01:46 -07:00
Daniel Stone 3d21fa56f5 libclc: Make all built-ins overloadable
The SPIR spec states that all OpenCL built-in functions should be
overloadable and mangled, to ensure consistency.

Add the overload attribute to functions which were missing them:
work dimensions, memory barriers and fences, and events.

Reviewed By: tstellar, jenatali

Differential Revision: https://reviews.llvm.org/D82078
2020-08-17 13:55:48 -07:00
Boris Brezillon 3a7051d9c2 libclc: Fix FP_ILOGBNAN definition
Fix FP_ILOGBNAN definition to match the opencl-c-base.h one and
guarantee that FP_ILOGBNAN and FP_ILOGB0 are different. Doing that
implies fixing ilogb() implementation to return the right value.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>

Reviewed By: jvesely

Differential Revision: https://reviews.llvm.org/D83473
2020-08-17 13:45:43 -07:00
Jan Vesely 4b23a2e8e9 libclc: Move rsqrt implementation to a .cl file
Reviewer: awatry
Differential Revision: https://reviews.llvm.org/D74013
2020-02-09 14:42:09 -05:00
Jan Vesely 4a725996e5 sincos: Simplify declaration headers.
This follows the same pattern as modf and fract.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

llvm-svn: 356028
2019-03-13 07:13:34 +00:00
Jan Vesely e7c0c37a31 fdim: Use binary_decl_tt.inc instead of custom inc file.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356027
2019-03-13 07:13:32 +00:00
Jan Vesely 5b0600c277 nextafter: Use binary_decl_tt.inc instead of custom inc file.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356026
2019-03-13 07:13:30 +00:00
Jan Vesely e438b58cd0 copysign: Use binary_decl_tt.inc instead of custom inc file.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356025
2019-03-13 07:13:28 +00:00
Jan Vesely 81bc9ee81c atan2pi: Use binary_decl_tt.inc instead of custom inc file.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356024
2019-03-13 07:13:26 +00:00
Jan Vesely 9526e02021 atan2: Use binary_decl_tt.inc instead of custom inc file.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356023
2019-03-13 07:13:24 +00:00
Jan Vesely 8985c9c212 hypot: Use binary_decl_tt.inc instead of custom inc file
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356022
2019-03-13 07:13:22 +00:00
Jan Vesely 5b136ca125 Move unary_instrinsic.inc to private headers.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356021
2019-03-13 07:06:19 +00:00
Jan Vesely 2aa333f3d1 Move binary_intrinsic.h to private headers.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356020
2019-03-13 07:06:15 +00:00
Jan Vesely 1f4a8a9158 Move ternary_intrinsic.h to private headers.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356019
2019-03-13 07:06:13 +00:00
Jan Vesely ee555aa992 trunc: Remove llvm intrinsic from the header.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356018
2019-03-13 07:06:10 +00:00
Jan Vesely 1c395b74bf round: Remove llvm intrinsic from the header
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356017
2019-03-13 07:06:08 +00:00
Jan Vesely b3d64e4a83 rint: Remove llvm intrinsic from the header.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356016
2019-03-13 07:06:06 +00:00
Jan Vesely fd199f0139 floor: Remove llvm isntrinsic from the header.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356015
2019-03-13 07:06:03 +00:00
Jan Vesely fda15e56a6 fabs: Remove llvm intrinsic from the header.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356014
2019-03-13 07:06:00 +00:00
Jan Vesely 54eb4d3a6d ceil: Remove llvm intrinsic from the header.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356013
2019-03-13 07:05:58 +00:00
Jan Vesely 4b0b9a727e mad: Convert to standard ternary header
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356011
2019-03-13 07:05:53 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Jan Vesely 8382e5bc48 atom: Use volatile pointers for cl_khr_{global,local}_int32_{base,extended}_atomics
int64 versions were switched to volatile pointers in cl1.1
cl1.1 also renamed atom_ functions to atomic_ that use volatile pointers.
CTS and applications use volatile pointers.

Passes CTS on carrizo
no return piglit tests still pass on turks.

Reviewed-By: Aaron Watry <awatry@gmail.com>
Tested-By: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 335280
2018-06-21 19:27:39 +00:00
Jan Vesely f965b46c8e atomic: Provide function implementation of atomic_{dec,inc}
Reviewed-By: Aaron Watry <awatry@gmail.com>
Tested-By: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 335278
2018-06-21 19:27:26 +00:00
Jan Vesely b9cbe0bf51 atom: Consolidate cl_khr_int64_{base,extended}_atomics declarations
Reviewed-By: Aaron Watry <awatry@gmail.com>
Tested-By: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 335277
2018-06-21 19:27:23 +00:00
Jan Vesely d1c3811ff7 atom: Consolidate cl_khr_{local,global}_int32_{base,extended}_atomics declarations
Reviewed-By: Aaron Watry <awatry@gmail.com>
Tested-By: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 335276
2018-06-21 19:27:18 +00:00
Jan Vesely fe08de0c89 atomic: Cleanup atomic_cmpxchg header
It's easier to just list the four function declarations

Reviewed-By: Aaron Watry <awatry@gmail.com>
Tested-By: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 335275
2018-06-21 19:27:12 +00:00
Jan Vesely eabc110372 atomic: Move define cleanup to shared include
Reviewed-By: Aaron Watry <awatry@gmail.com>
Tested-By: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 335274
2018-06-21 19:27:07 +00:00
Jan Vesely 6e85e6309d math/fma: Add fp32 software implementation
Passes CTS on carrizo (when forced to use sw fma) and turks.
Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

llvm-svn: 334226
2018-06-07 20:27:43 +00:00
Jan Vesely 70a270da5f Add initial support for half precision builtins
v2: fix fmax implementation
    use consistent checks for __CLC_FP_SIZE
    add missing TODOs
    fix whitespace in definitions.h
v3: undef ZERO in modf.inc

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Reviewed-by: Aaron Watry <awatry@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 332677
2018-05-17 22:55:30 +00:00
Jan Vesely 8db45e4cf1 remquo: Port from amd builtins
double version passes on carrizo. float version fails on denormals.

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry <awatry@gmail.com>
llvm-svn: 331434
2018-05-03 05:44:26 +00:00
Jan Vesely 616a38a693 clc_sqrt: Reuse unary_decl.inc
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 331366
2018-05-02 16:06:52 +00:00
Jan Vesely 1647e50359 relational/select: Condition types for half are short/ushort, not char/uchar
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 330851
2018-04-25 17:36:36 +00:00
Jan Vesely 15c388cd79 exp10: Port from amd builtins
Passes CTS on carrizo and turks.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed and Tested (on RX 580) by: Aaron Watry <awatry@gmail.com>

llvm-svn: 330197
2018-04-17 18:08:08 +00:00
Jan Vesely 4be0339023 hypot: Port from amd builtins
v2: Fix whitespace errors

Use only subnormal path.
Passes CTS on carrizo and turks.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry <awatry@gmail.com>

llvm-svn: 329647
2018-04-10 00:11:58 +00:00
Jan Vesely 93af966747 fmod: Port from amd_builtins
Uses only denormal path for fp32.
Passes CTS on carrizo and turks.

v2: whitespace fix

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry <awatry@gmail.com>
llvm-svn: 329433
2018-04-06 17:43:08 +00:00
Jan Vesely 5b10494fa8 remainder: Port from amd builtins
Mostly ported from amd_builtins, uses only denormal path for fp32.
Passes CTS on carrizo and turks

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327818
2018-03-19 01:01:10 +00:00
Jan Vesely b672f7a251 nan: Implement
Passes CTS on carrizo and turks

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327324
2018-03-12 19:46:52 +00:00
Jan Vesely 0883c4d365 integer/gentype: Add __CLC_VECSIZE macro
Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327043
2018-03-08 18:58:05 +00:00
Jan Vesely 17e8679493 popcount: Provide function implementation rather than intrinsic redirect
amdgcn will need to override this

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327042
2018-03-08 18:58:00 +00:00
Jan Vesely ae156b66f8 select: Add vector implementation
Passes CTS on Carrizo

Reviewed-by: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 326819
2018-03-06 17:48:43 +00:00
Jan Vesely dbaf6d0f7c Move cl_khr_fp64 exntension enablement to gentype include lists
This will make adding cl_khr_fp16 support easier

Reviewed-by: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 326816
2018-03-06 17:48:35 +00:00
Jan Vesely 1c570566c3 Add vstore_half_rte implementation
Passes CTS on carrizo

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324376
2018-02-06 18:44:50 +00:00
Jan Vesely f2d876ae83 Add vstore_half_rtp implementation
Passes CTS on carrizo

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324375
2018-02-06 18:44:47 +00:00
Jan Vesely 2655312c69 Add vstore_half_rtn implementation
Passes CTS on carrizo

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324374
2018-02-06 18:44:45 +00:00
Jan Vesely d526a2b6e8 Add vstore_half_rtz implementation
Passes CTS on carrizo

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324373
2018-02-06 18:44:43 +00:00
Jan Vesely 4475aca172 vstore_half: Consolidate declarations
Add support for rounding suffix

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324372
2018-02-06 18:44:41 +00:00
Jan Vesely 3b8b4eb64d half_powr: Implement using powr
v2: Use full precision implementation

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 323942
2018-02-01 03:00:35 +00:00
Jan Vesely 7013857f95 tanpi: Port from amd_builtins
Passes piglit on turks and carrizo.
Passes CTS on carrizo.

Acked-By: Aaron Watry <awatry@gmail.com>
Tested-By: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 322980
2018-01-19 18:57:22 +00:00
Jan Vesely 03937bdec3 tan: Port from amd_builtins
v2: fixup constant precision
Passes piglit on turks and carrizo.
Passes CTS on carrizo
Fixes half_tan to pass CTS on carrizo

Acked-By: Aaron Watry <awatry@gmail.com>
Tested-By: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 322979
2018-01-19 18:57:19 +00:00