Index: cfe/trunk/lib/Frontend/InitPreprocessor.cpp =================================================================== --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp @@ -1034,6 +1034,10 @@ LangOpts.OpenCLVersion)) \ Builder.defineMacro(#Ext); #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) { Index: cfe/trunk/test/Preprocessor/predefined-macros.c =================================================================== --- cfe/trunk/test/Preprocessor/predefined-macros.c +++ cfe/trunk/test/Preprocessor/predefined-macros.c @@ -267,3 +267,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 - -x cl -triple spir-unknown-unknown \ +// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SPIR +// CHECK-SPIR: #define __IMAGE_SUPPORT__ 1