From 68ced6ce463c398aa8920ca0f77b7300baf1927b Mon Sep 17 00:00:00 2001 From: Evghenii Date: Mon, 28 Oct 2013 14:08:32 +0100 Subject: [PATCH] automatically adds -D__NVPTX__ when nvptx64 target is chosen --- builtins/target-avx-common.ll | 11 +++++++++++ module.cpp | 2 ++ 2 files changed, 13 insertions(+) diff --git a/builtins/target-avx-common.ll b/builtins/target-avx-common.ll index 1d317713..2343f263 100644 --- a/builtins/target-avx-common.ll +++ b/builtins/target-avx-common.ll @@ -283,3 +283,14 @@ define double @__max_uniform_double(double, double) nounwind readnone alwaysinli define_avgs() +;;;;;;; nvptx64 + +declare i32 @__tid_x() nounwind readnone alwaysinline +declare i32 @__warpsize() nounwind readnone alwaysinline +declare i32 @__ctaid_x() nounwind readnone alwaysinline +declare i32 @__ctaid_y() nounwind readnone alwaysinline +declare i32 @__ctaid_z() nounwind readnone alwaysinline +declare i32 @__nctaid_x() nounwind readnone alwaysinline +declare i32 @__nctaid_y() nounwind readnone alwaysinline +declare i32 @__nctaid_z() nounwind readnone alwaysinline + diff --git a/module.cpp b/module.cpp index 602f1b21..dce41457 100644 --- a/module.cpp +++ b/module.cpp @@ -1914,6 +1914,8 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre opts.addMacroDef(g->cppArgs[i].substr(2)); } } + if (g->target->getISA() == Target::NVPTX64) + opts.addMacroDef("__NVPTX__"); #if defined(LLVM_3_1) inst.getLangOpts().BCPLComment = 1;