diff options
author | Andrew Savonichev <andrew.savonichev@intel.com> | 2019-06-03 12:34:59 +0000 |
---|---|---|
committer | Andrew Savonichev <andrew.savonichev@intel.com> | 2019-06-03 12:34:59 +0000 |
commit | fa8cd7691ac28d07f6a127ed26f0dbe49699bd59 (patch) | |
tree | bbb3d165225aa4a425a9b6b6342c13840d552bfc /clang/lib/AST/ASTContext.cpp | |
parent | edfa756f3f5b9e31c69a34542d1b09c947f5dd2b (diff) | |
download | bcm5719-llvm-fa8cd7691ac28d07f6a127ed26f0dbe49699bd59.tar.gz bcm5719-llvm-fa8cd7691ac28d07f6a127ed26f0dbe49699bd59.zip |
[OpenCL] Use long instead of long long in x86 builtins
Summary: According to C99 standard long long is at least 64 bits in
size. However, OpenCL C defines long long as 128 bit signed
integer. This prevents one to use x86 builtins when compiling OpenCL C
code for x86 targets. The patch changes long long to long for OpenCL
only.
Patch by: Alexander Batashev <alexander.batashev@intel.com>
Reviewers: craig.topper, Ka-Ka, eandrews, erichkeane, Anastasia
Reviewed By: Ka-Ka, erichkeane, Anastasia
Subscribers: a.elovikov, yaxunl, Anastasia, cfe-commits, ivankara, etyurin, asavonic
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62580
llvm-svn: 362391
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 4f1df7cdf19..f732a7531db 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -9282,13 +9282,13 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, Unsigned = true; break; case 'L': - assert(!IsSpecial && "Can't use 'L' with 'W', 'N' or 'Z' modifiers"); + assert(!IsSpecial && "Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers"); assert(HowLong <= 2 && "Can't have LLLL modifier"); ++HowLong; break; case 'N': // 'N' behaves like 'L' for all non LP64 targets and 'int' otherwise. - assert(!IsSpecial && "Can't use two 'N', 'W' or 'Z' modifiers!"); + assert(!IsSpecial && "Can't use two 'N', 'W', 'Z' or 'O' modifiers!"); assert(HowLong == 0 && "Can't use both 'L' and 'N' modifiers!"); #ifndef NDEBUG IsSpecial = true; @@ -9298,7 +9298,7 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, break; case 'W': // This modifier represents int64 type. - assert(!IsSpecial && "Can't use two 'N', 'W' or 'Z' modifiers!"); + assert(!IsSpecial && "Can't use two 'N', 'W', 'Z' or 'O' modifiers!"); assert(HowLong == 0 && "Can't use both 'L' and 'W' modifiers!"); #ifndef NDEBUG IsSpecial = true; @@ -9316,7 +9316,7 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, break; case 'Z': // This modifier represents int32 type. - assert(!IsSpecial && "Can't use two 'N', 'W' or 'Z' modifiers!"); + assert(!IsSpecial && "Can't use two 'N', 'W', 'Z' or 'O' modifiers!"); assert(HowLong == 0 && "Can't use both 'L' and 'Z' modifiers!"); #ifndef NDEBUG IsSpecial = true; @@ -9335,6 +9335,17 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, break; } break; + case 'O': + assert(!IsSpecial && "Can't use two 'N', 'W', 'Z' or 'O' modifiers!"); + assert(HowLong == 0 && "Can't use both 'L' and 'O' modifiers!"); + #ifndef NDEBUG + IsSpecial = true; + #endif + if (Context.getLangOpts().OpenCL) + HowLong = 1; + else + HowLong = 2; + break; } } |