This commit moves the various vload and vstore builtins (including vload_half, vloada_half, etc.) to the CLC library. This is almost entirely a code move and does not make any attempt to clean up or optimize the definitions of these builtins. There is no change to any of the targets' builtin libraries, except that the vstore helper rounding functions are now internalized. Cleanups can come in future work. The new CLC declarations and new OpenCL wrappers show how these CLC implementations could be defined more simply. The builtins could probably also be vectorized in future work; right now all of the 'half' versions for both vload and vstore are essentially scalarized.
52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// This does not exist for fp16
|
|
#if __CLC_FPSIZE > 16
|
|
|
|
#if __CLC_FPSIZE == 32
|
|
#define STORE_HALF_BUILTIN __builtin_store_halff
|
|
#elif __CLC_FPSIZE == 64
|
|
#define STORE_HALF_BUILTIN __builtin_store_half
|
|
#else
|
|
#error "Invalid FP size"
|
|
#endif
|
|
|
|
#ifndef __CLC_SCALAR
|
|
|
|
#if __CLC_VECSIZE == 3
|
|
#define __CLC_OFFSET 4
|
|
#else
|
|
#define __CLC_OFFSET __CLC_VECSIZE
|
|
#endif
|
|
|
|
FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __private,
|
|
STORE_HALF_BUILTIN);
|
|
FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __local,
|
|
STORE_HALF_BUILTIN);
|
|
FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __global,
|
|
STORE_HALF_BUILTIN);
|
|
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
|
|
FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __generic,
|
|
STORE_HALF_BUILTIN);
|
|
#endif
|
|
|
|
#undef __CLC_OFFSET
|
|
#else
|
|
FUNC(, 1, 1, __CLC_GENTYPE, __private, STORE_HALF_BUILTIN);
|
|
FUNC(, 1, 1, __CLC_GENTYPE, __local, STORE_HALF_BUILTIN);
|
|
FUNC(, 1, 1, __CLC_GENTYPE, __global, STORE_HALF_BUILTIN);
|
|
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
|
|
FUNC(, 1, 1, __CLC_GENTYPE, __generic, STORE_HALF_BUILTIN);
|
|
#endif
|
|
#endif
|
|
|
|
#undef STORE_HALF_BUILTIN
|
|
|
|
#endif
|