[CUDA] Provide integer SIMD functions for CUDA-9.2
authorArtem Belevich <tra@google.com>
Fri, 20 Jul 2018 17:44:34 +0000 (17:44 +0000)
committerArtem Belevich <tra@google.com>
Fri, 20 Jul 2018 17:44:34 +0000 (17:44 +0000)
commitfa07bb646cc39f4f218ab59aac4da813edc9053d
treedb0f8d5456a739d1d8f3157965145a195bfd9b7c
parent5e729dcc03811b7d31058fe77954417bfce55412
[CUDA] Provide integer SIMD functions for CUDA-9.2

CUDA-9.2 made all integer SIMD functions into compiler builtins,
so clang no longer has access to the implementation of these
functions in either headers of libdevice and has to provide
its own implementation.

This is mostly a 1:1 mapping to a corresponding PTX instructions
with an exception of vhadd2/vhadd4 that don't have an equivalent
instruction and had to be implemented with a bit hack.

Performance of this implementation will be suboptimal for SM_50
and newer GPUs where PTXAS generates noticeably worse code for
the SIMD instructions compared to the code it generates
for the inline assembly generated by nvcc (or used to come
with CUDA headers).

Differential Revision: https://reviews.llvm.org/D49274

llvm-svn: 337587
clang/lib/Headers/__clang_cuda_device_functions.h
clang/lib/Headers/__clang_cuda_libdevice_declares.h