From: Chris Lattner Date: Thu, 30 Apr 2009 06:18:40 +0000 (+0000) Subject: only support int128_t on 64-bit and larger targets. 32-bit targets don't X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d150c84514dbf15975960a3ea46bdf6b7f16a5b;p=clang only support int128_t on 64-bit and larger targets. 32-bit targets don't have support for __divti3 and friends. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70480 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 8ce3ce0be6..b931cf8967 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -18,6 +18,7 @@ #include "clang/AST/DeclObjC.h" #include "clang/AST/Expr.h" #include "clang/Lex/Preprocessor.h" +#include "clang/Basic/TargetInfo.h" using namespace clang; /// ConvertQualTypeToStringFn - This function is used to pretty print the @@ -109,15 +110,17 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { TUScope = S; PushDeclContext(S, Context.getTranslationUnitDecl()); - // Install [u]int128_t. - PushOnScopeChains(TypedefDecl::Create(Context, CurContext, - SourceLocation(), - &Context.Idents.get("__int128_t"), - Context.Int128Ty), TUScope); - PushOnScopeChains(TypedefDecl::Create(Context, CurContext, - SourceLocation(), - &Context.Idents.get("__uint128_t"), - Context.UnsignedInt128Ty), TUScope); + if (PP.getTargetInfo().getPointerWidth(0) >= 64) { + // Install [u]int128_t for 64-bit targets. + PushOnScopeChains(TypedefDecl::Create(Context, CurContext, + SourceLocation(), + &Context.Idents.get("__int128_t"), + Context.Int128Ty), TUScope); + PushOnScopeChains(TypedefDecl::Create(Context, CurContext, + SourceLocation(), + &Context.Idents.get("__uint128_t"), + Context.UnsignedInt128Ty), TUScope); + } if (!PP.getLangOptions().ObjC1) return; diff --git a/test/CodeGen/uint128_t.c b/test/CodeGen/uint128_t.c index b3261dd687..b3bf727962 100644 --- a/test/CodeGen/uint128_t.c +++ b/test/CodeGen/uint128_t.c @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -emit-llvm -o - +// RUN: clang-cc %s -emit-llvm -o - -triple=x86_64-apple-darwin9 typedef unsigned long long uint64_t; extern uint64_t numer; diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 5540a6868f..c49abeb7ef 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm %s -o %t && +// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 && // FIXME: This test is intentionally trivial, because we can't yet // CodeGen anything real in C++. diff --git a/test/CodeGenObjC/encode-test-5.m b/test/CodeGenObjC/encode-test-5.m index bf1a0a6725..a76b071e7f 100644 --- a/test/CodeGenObjC/encode-test-5.m +++ b/test/CodeGenObjC/encode-test-5.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple=i686-apple-darwin9 -fnext-runtime -emit-llvm -o %t %s && +// RUN: clang-cc -triple=x86_64-apple-darwin9 -fnext-runtime -emit-llvm -o %t %s && // RUN: grep ji %t | count 1 && char *a = @encode(_Complex int); diff --git a/test/Sema/types.c b/test/Sema/types.c index d1e9fcc052..3ee76756ee 100644 --- a/test/Sema/types.c +++ b/test/Sema/types.c @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -pedantic -verify +// RUN: clang-cc %s -pedantic -verify -triple=x86_64-apple-darwin9 // rdar://6097662 typedef int (*T)[2];