summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Savonichev <andrew.savonichev@intel.com>2019-06-03 12:34:59 +0000
committerAndrew Savonichev <andrew.savonichev@intel.com>2019-06-03 12:34:59 +0000
commit5663f71c62400a9a2d309c8853831f118afc1bcc (patch)
treeb8efb3ddbbf11ff07286bd520620dbade381ea5f /lib
parenta6289dec43c7e84385a4b865db7cba66333f90a1 (diff)
downloadclang-5663f71c62400a9a2d309c8853831f118afc1bcc.tar.gz
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@362391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/ASTContext.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 4f1df7cdf1..f732a7531d 100644
--- a/lib/AST/ASTContext.cpp
+++ b/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;
}
}