llvm-project/clang/test/SemaCUDA
Jonas Hahnfeld 931939bf92 [CUDA/OpenMP] Define only some host macros during device compilation
When compiling CUDA or OpenMP device code Clang parses header files
that expect certain predefined macros from the host architecture. To
make this work the compiler passes the host triple via the -aux-triple
argument and (until now) pulls in all macros for that "auxiliary triple"
unconditionally.

However this results in defines like __SSE_MATH__ that will trigger
inline assembly making use of the "advertised" target features. See
the discussion of D47849 and PR38464 for a detailed explanation of
the encountered problems.

Instead of blacklisting "known bad" examples this patch starts adding
defines that are needed for certain headers like bits/wordsize.h and
bits/mathinline.h.
The disadvantage of this approach is that it decouples the definitions
from their target toolchain. However in my opinion it's more important
to keep definitions for one header close together. For one this will
include a clear documentation why these particular defines are needed.
Furthermore it simplifies maintenance because adding defines for a new
header or support for a new aux-triple only needs to touch one piece
of code.

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

llvm-svn: 340681
2018-08-25 13:42:40 +00:00
..
Inputs
add-inline-in-definition.cu [CUDA] Use only the GVALinkage on function definitions. 2016-11-08 23:45:51 +00:00
addr-of-overloaded-fn.cu
alias.cu
amdgpu-attrs.cu [CUDA][HIP] Allow CUDA __global__ functions to have amdgpu kernel attributes 2018-06-12 23:58:59 +00:00
asm-constraints-device.cu
asm-constraints-mixed.cu
attr-declspec.cu [CUDA] Add __declspec spellings for CUDA attributes. 2017-01-05 16:53:04 +00:00
attributes-on-non-cuda.cu
bad-attributes.cu [CUDA] Disallow __shared__ variables in host functions. 2016-10-13 18:45:13 +00:00
bad-calls-on-same-line.cu [CUDA] Simplify some repeated diagnostic expectations in CUDA tests. 2016-10-21 20:50:47 +00:00
builtins.cu [CUDA/OpenMP] Define only some host macros during device compilation 2018-08-25 13:42:40 +00:00
call-device-fn-from-host.cu [CUDA] Fixed false error reporting in case of calling H->G->HD->D. 2018-03-23 19:49:03 +00:00
call-host-fn-from-device.cu [CUDA] Simplify some repeated diagnostic expectations in CUDA tests. 2016-10-21 20:50:47 +00:00
call-stack-for-deferred-err.cu [CUDA] Report "unsupported VLA" errors only on device side. 2017-11-28 18:51:42 +00:00
config-type.cu
cuda-builtin-vars.cu
cuda-inherits-calling-conv.cu [CUDA] Let NVPTX inherit the host's calling conventions. 2017-01-05 16:53:38 +00:00
cxx11-kernel-call.cu
device-var-init.cu [CUDA][HIP] Allow function-scope static const variable 2018-07-28 03:05:25 +00:00
error-includes-mode.cu [CUDA] When compilation fails, print the compilation mode. 2017-09-07 18:37:16 +00:00
exceptions.cu [CUDA] When we emit an error that might have been deferred, also print a callstack. 2016-10-19 21:15:01 +00:00
extern-shared.cu [CUDA] Allow "extern __shared__ Foo foo[]" within anon. namespaces. 2018-05-17 16:15:07 +00:00
function-overload.cu Fix some handling of AST nodes with diagnostics. 2018-03-28 04:16:13 +00:00
function-target.cu
function-template-overload.cu Fix typos in clang 2018-04-06 15:14:32 +00:00
global-initializers-host.cu
gnu-inline.cu [CUDA] [AST] Allow isInlineDefinitionExternallyVisible to be called on functions without bodies. 2016-10-28 16:26:26 +00:00
host-device-constexpr.cu
implicit-copy.cu
implicit-device-lambda.cu [CUDA] Rework tests now that we emit deferred diagnostics during sema. Test-only change. 2016-10-19 00:06:49 +00:00
implicit-intrinsic.cu
implicit-member-target-collision-cxx11.cu
implicit-member-target-collision.cu
implicit-member-target.cu
kernel-call.cu Fix some handling of AST nodes with diagnostics. 2018-03-28 04:16:13 +00:00
launch_bounds.cu Determine the attribute subject for diagnostics based on declarative information in DeclNodes.td. This greatly reduces the number of enumerated values used for more complex diagnostics; these are now only required when the "attribute only applies to" diagnostic needs to be generated manually as part of semantic processing. 2017-11-26 20:01:12 +00:00
lit.local.cfg
method-target.cu [CUDA] Emit deferred diagnostics during Sema rather than during codegen. 2016-10-13 20:52:12 +00:00
no-call-stack-for-immediate-errs.cu [CUDA] Report "unsupported VLA" errors only on device side. 2017-11-28 18:51:42 +00:00
no-destructor-overload.cu PR34163: Don't cache an incorrect key function for a class if queried between 2017-08-12 01:46:03 +00:00
no-host-device-constexpr.cu
overloaded-delete.cu Declare H and H new/delete. 2016-10-21 20:34:05 +00:00
pr27778.cu
qualifiers.cu
reference-to-kernel-fn.cu [CUDA] Emit deferred diagnostics during Sema rather than during codegen. 2016-10-13 20:52:12 +00:00
trace-through-global.cu [CUDA] Simplify some repeated diagnostic expectations in CUDA tests. 2016-10-21 20:50:47 +00:00
vararg.cu
vla.cu [CUDA] Report "unsupported VLA" errors only on device side. 2017-11-28 18:51:42 +00:00