llvm/clang/test/SemaCUDA/spirv-int128.cu
Henry Linjamäki c99b2c6316 CUDA/HIP: Allow __int128 on the host side
Consider case where `__int128` type is supported by the host target but
not by a device target (e.g. spirv*). Clang emits an error message for
unsupported type even if the device code does not use it. This patch
fixes this issue by emitting the error message when the device code
attempts to use the unsupported type.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D111047
2022-01-04 16:09:26 -08:00

17 lines
461 B
Plaintext

// RUN: %clang_cc1 -triple spirv64 -aux-triple x86_64-unknown-linux-gnu \
// RUN: -fcuda-is-device -verify -fsyntax-only %s
#define __device__ __attribute__((device))
__int128 h_glb;
__device__ __int128 d_unused;
// expected-note@+1 {{'d_glb' defined here}}
__device__ __int128 d_glb;
__device__ __int128 bar() {
// expected-error@+1 {{'d_glb' requires 128 bit size '__int128' type support, but target 'spirv64' does not support it}}
return d_glb;
}