aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-09-07 07:08:02 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-09-07 07:08:02 +0000
commitf333de37528567ce384554bc333386e4a474af0b (patch)
tree2ee9e2afda5c4fa7e96039bc76a56f9de10e643c /clang/lib/Frontend/InitPreprocessor.cpp
parent8afb5cd89446d5bc011bf8737ce1ae80fa9db858 (diff)
downloadllvm-f333de37528567ce384554bc333386e4a474af0b.zip
llvm-f333de37528567ce384554bc333386e4a474af0b.tar.gz
llvm-f333de37528567ce384554bc333386e4a474af0b.tar.bz2
OpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness
OpenCL requires __ENDIAN_LITTLE__ be set for little endian targets. The default for targets was also apparently big endian, so AMDGPU was incorrectly reported as big endian. Set this from the triple so targets don't have another place to set the endianness. llvm-svn: 280787
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index f8b912e..ea5b48c 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -435,6 +435,9 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
Builder.defineMacro("CL_VERSION_1_2", "120");
Builder.defineMacro("CL_VERSION_2_0", "200");
+ if (TI.isLittleEndian())
+ Builder.defineMacro("__ENDIAN_LITTLE__");
+
if (LangOpts.FastRelaxedMath)
Builder.defineMacro("__FAST_RELAXED_MATH__");
}