[clang] 3a1b075 - Define __SPIR__ macro for spir/spir64 targets.
Vyacheslav Zakharin via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 3 12:36:42 PDT 2020
Author: Vyacheslav Zakharin
Date: 2020-06-03T12:36:21-07:00
New Revision: 3a1b07506c1fc6e6aee528289341aa0d0d806814
URL: https://github.com/llvm/llvm-project/commit/3a1b07506c1fc6e6aee528289341aa0d0d806814
DIFF: https://github.com/llvm/llvm-project/commit/3a1b07506c1fc6e6aee528289341aa0d0d806814.diff
LOG: Define __SPIR__ macro for spir/spir64 targets.
Differential Revision: https://reviews.llvm.org/D80655
Added:
Modified:
clang/lib/Basic/Targets/SPIR.cpp
clang/test/Preprocessor/predefined-macros.c
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/SPIR.cpp b/clang/lib/Basic/Targets/SPIR.cpp
index a9b815d13bc1..9b7aab85314a 100644
--- a/clang/lib/Basic/Targets/SPIR.cpp
+++ b/clang/lib/Basic/Targets/SPIR.cpp
@@ -23,10 +23,12 @@ void SPIRTargetInfo::getTargetDefines(const LangOptions &Opts,
void SPIR32TargetInfo::getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const {
+ SPIRTargetInfo::getTargetDefines(Opts, Builder);
DefineStd(Builder, "SPIR32", Opts);
}
void SPIR64TargetInfo::getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const {
+ SPIRTargetInfo::getTargetDefines(Opts, Builder);
DefineStd(Builder, "SPIR64", Opts);
}
diff --git a/clang/test/Preprocessor/predefined-macros.c b/clang/test/Preprocessor/predefined-macros.c
index def105f4c52e..083f0e539d88 100644
--- a/clang/test/Preprocessor/predefined-macros.c
+++ b/clang/test/Preprocessor/predefined-macros.c
@@ -173,7 +173,17 @@
// RUN: %clang_cc1 %s -E -dM -o - -x cl -triple spir-unknown-unknown \
// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SPIR
-// CHECK-SPIR: #define __IMAGE_SUPPORT__ 1
+// CHECK-SPIR-DAG: #define __IMAGE_SUPPORT__ 1
+// CHECK-SPIR-DAG: #define __SPIR__ 1
+// CHECK-SPIR-DAG: #define __SPIR32__ 1
+// CHECK-SPIR-NOT: #define __SPIR64__ 1
+
+// RUN: %clang_cc1 %s -E -dM -o - -x cl -triple spir64-unknown-unknown \
+// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SPIR64
+// CHECK-SPIR64-DAG: #define __IMAGE_SUPPORT__ 1
+// CHECK-SPIR64-DAG: #define __SPIR__ 1
+// CHECK-SPIR64-DAG: #define __SPIR64__ 1
+// CHECK-SPIR64-NOT: #define __SPIR32__ 1
// RUN: %clang_cc1 %s -E -dM -o - -x hip -triple amdgcn-amd-amdhsa \
// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-HIP
More information about the cfe-commits
mailing list