r262124 - AMDGPU: Fix broken/confusing predefined macro
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 27 01:06:26 PST 2016
Author: arsenm
Date: Sat Feb 27 03:06:26 2016
New Revision: 262124
URL: http://llvm.org/viewvc/llvm-project?rev=262124&view=rev
Log:
AMDGPU: Fix broken/confusing predefined macro
amdgcn should not be defining __R600__
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/predefined-arch-macros.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=262124&r1=262123&r2=262124&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Feb 27 03:06:26 2016
@@ -1865,7 +1865,11 @@ public:
void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const override {
- Builder.defineMacro("__R600__");
+ if (getTriple().getArch() == llvm::Triple::amdgcn)
+ Builder.defineMacro("__AMDGCN__");
+ else
+ Builder.defineMacro("__R600__");
+
if (hasFMAF)
Builder.defineMacro("__HAS_FMAF__");
if (hasLDEXPF)
Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=262124&r1=262123&r2=262124&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Sat Feb 27 03:06:26 2016
@@ -1962,3 +1962,17 @@
// RUN: | FileCheck %s -check-prefix=CHECK_SYSTEMZ_ZVECTOR
//
// CHECK_SYSTEMZ_ZVECTOR: #define __VEC__ 10301
+
+// Begin amdgcn tests ----------------
+//
+// RUN: %clang -march=amdgcn -E -dM %s -o - 2>&1 \
+// RUN: -target amdgcn-unknown-unknown \
+// RUN: | FileCheck %s -check-prefix=CHECK_AMDGCN
+// CHECK_AMDGCN: #define __AMDGCN__ 1
+
+// Begin r600 tests ----------------
+//
+// RUN: %clang -march=amdgcn -E -dM %s -o - 2>&1 \
+// RUN: -target r600-unknown-unknown \
+// RUN: | FileCheck %s -check-prefix=CHECK_R600
+// CHECK_R600: #define __R600__ 1
More information about the cfe-commits
mailing list