Index: lib/Frontend/InitPreprocessor.cpp =================================================================== --- lib/Frontend/InitPreprocessor.cpp +++ lib/Frontend/InitPreprocessor.cpp @@ -1030,6 +1030,10 @@ #include "clang/Basic/OpenCLExtensions.def" } + auto Arch = TI.getTriple().getArch(); + if (Arch == llvm::Triple::spir || Arch == llvm::Triple::spir64) + Builder.defineMacro("__IMAGE_SUPPORT__"); + if (TI.hasInt128Type() && LangOpts.CPlusPlus && LangOpts.GNUMode) { // For each extended integer type, g++ defines a macro mapping the // index of the type (0 in this case) in some list of extended types Index: test/Preprocessor/predefined-macros.c =================================================================== --- test/Preprocessor/predefined-macros.c +++ test/Preprocessor/predefined-macros.c @@ -209,3 +209,7 @@ // CHECK-ARM64-MINGW: #define _WIN32 1 // CHECK-ARM64-MINGW: #define _WIN64 1 // CHECK-ARM64-MINGW: #define __aarch64__ 1 + +// RUN: %clang_cc1 %s -E -dM -o - -triple spir-unknown-unknown \ +// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SPIR +// CHECK-SPIR: #define __IMAGE_SUPPORT__ 1