Index: include/clang/Basic/Builtins.def =================================================================== --- include/clang/Basic/Builtins.def +++ include/clang/Basic/Builtins.def @@ -196,6 +196,9 @@ BUILTIN(__builtin_exp2 , "dd" , "Fne") BUILTIN(__builtin_exp2f, "ff" , "Fne") BUILTIN(__builtin_exp2l, "LdLd", "Fne") +BUILTIN(__builtin_exp10 , "dd" , "Fne") +BUILTIN(__builtin_exp10f, "ff" , "Fne") +BUILTIN(__builtin_exp10l, "LdLd", "Fne") BUILTIN(__builtin_expm1 , "dd", "Fne") BUILTIN(__builtin_expm1f, "ff", "Fne") BUILTIN(__builtin_expm1l, "LdLd", "Fne") @@ -1137,6 +1140,10 @@ LIBBUILTIN(exp2f, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(exp2l, "LdLd", "fne", "math.h", ALL_LANGUAGES) +LIBBUILTIN(exp10, "dd", "fne", "math.h", ALL_LANGUAGES) +LIBBUILTIN(exp10f, "ff", "fne", "math.h", ALL_LANGUAGES) +LIBBUILTIN(exp10l, "LdLd", "fne", "math.h", ALL_LANGUAGES) + LIBBUILTIN(expm1, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(expm1f, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(expm1l, "LdLd", "fne", "math.h", ALL_LANGUAGES) @@ -1374,10 +1381,6 @@ LIBBUILTIN(__tanpi, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(__tanpif, "ff", "fne", "math.h", ALL_LANGUAGES) -// Similarly, __exp10 is OS X only -LIBBUILTIN(__exp10, "dd", "fne", "math.h", ALL_LANGUAGES) -LIBBUILTIN(__exp10f, "ff", "fne", "math.h", ALL_LANGUAGES) - // Blocks runtime Builtin math library functions LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES) LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES) Index: include/clang/Basic/CodeGenOptions.h =================================================================== --- include/clang/Basic/CodeGenOptions.h +++ include/clang/Basic/CodeGenOptions.h @@ -54,7 +54,9 @@ enum VectorLibrary { NoLibrary, // Don't use any vector library. Accelerate, // Use the Accelerate framework. - SVML // Intel short vector math library. + SVML, // Intel short vector math library. + // SLEEF is experimental for now. + SLEEF // SLEEF - SIMD Library for Evaluating Elementary Functions. }; Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1404,7 +1404,7 @@ Group, Flags<[CC1Option]>, HelpText<"Disables an experimental new pass manager in LLVM.">; def fveclib : Joined<["-"], "fveclib=">, Group, Flags<[CC1Option]>, - HelpText<"Use the given vector functions library">, Values<"Accelerate,SVML,none">; + HelpText<"Use the given vector functions library">, Values<"Accelerate,SVML,SLEEF (experimental),none">; def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group, HelpText<"Disallow implicit conversions between vectors with a different number of elements or different element types">, Flags<[CC1Option]>; def fno_merge_all_constants : Flag<["-"], "fno-merge-all-constants">, Group, Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -347,6 +347,9 @@ case CodeGenOptions::SVML: TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML); break; + case CodeGenOptions::SLEEF: // Experimental for now. + TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SLEEF); + break; default: break; } Index: lib/CodeGen/CGBuiltin.cpp =================================================================== --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -1501,6 +1501,62 @@ case Builtin::BI__builtin_copysignf128: return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::copysign)); + case Builtin::BIacos: + case Builtin::BIacosf: + case Builtin::BIacosl: + case Builtin::BI__builtin_acos: + case Builtin::BI__builtin_acosf: + case Builtin::BI__builtin_acosl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::acos)); + + case Builtin::BIacosh: + case Builtin::BIacoshf: + case Builtin::BIacoshl: + case Builtin::BI__builtin_acosh: + case Builtin::BI__builtin_acoshf: + case Builtin::BI__builtin_acoshl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::acosh)); + + case Builtin::BIasin: + case Builtin::BIasinf: + case Builtin::BIasinl: + case Builtin::BI__builtin_asin: + case Builtin::BI__builtin_asinf: + case Builtin::BI__builtin_asinl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::asin)); + + case Builtin::BIasinh: + case Builtin::BIasinhf: + case Builtin::BIasinhl: + case Builtin::BI__builtin_asinh: + case Builtin::BI__builtin_asinhf: + case Builtin::BI__builtin_asinhl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::asinh)); + + case Builtin::BIatan: + case Builtin::BIatanf: + case Builtin::BIatanl: + case Builtin::BI__builtin_atan: + case Builtin::BI__builtin_atanf: + case Builtin::BI__builtin_atanl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::atan)); + + case Builtin::BIatan2: + case Builtin::BIatan2f: + case Builtin::BIatan2l: + case Builtin::BI__builtin_atan2: + case Builtin::BI__builtin_atan2f: + case Builtin::BI__builtin_atan2l: + return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::atan2)); + + case Builtin::BIatanh: + case Builtin::BIatanhf: + case Builtin::BIatanhl: + case Builtin::BI__builtin_atanh: + case Builtin::BI__builtin_atanhf: + case Builtin::BI__builtin_atanhl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::atanh)); + case Builtin::BIcos: case Builtin::BIcosf: case Builtin::BIcosl: @@ -1509,6 +1565,14 @@ case Builtin::BI__builtin_cosl: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::cos)); + case Builtin::BIcosh: + case Builtin::BIcoshf: + case Builtin::BIcoshl: + case Builtin::BI__builtin_cosh: + case Builtin::BI__builtin_coshf: + case Builtin::BI__builtin_coshl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::cosh)); + case Builtin::BIexp: case Builtin::BIexpf: case Builtin::BIexpl: @@ -1525,6 +1589,14 @@ case Builtin::BI__builtin_exp2l: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::exp2)); + case Builtin::BIexp10: + case Builtin::BIexp10f: + case Builtin::BIexp10l: + case Builtin::BI__builtin_exp10: + case Builtin::BI__builtin_exp10f: + case Builtin::BI__builtin_exp10l: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::exp10)); + case Builtin::BIfabs: case Builtin::BIfabsf: case Builtin::BIfabsl: @@ -1579,6 +1651,14 @@ return RValue::get(Builder.CreateFRem(Arg1, Arg2, "fmod")); } + case Builtin::BIlgamma: + case Builtin::BIlgammaf: + case Builtin::BIlgammal: + case Builtin::BI__builtin_lgamma: + case Builtin::BI__builtin_lgammaf: + case Builtin::BI__builtin_lgammal: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::lgamma)); + case Builtin::BIlog: case Builtin::BIlogf: case Builtin::BIlogl: @@ -1643,6 +1723,14 @@ case Builtin::BI__builtin_sinl: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::sin)); + case Builtin::BIsinh: + case Builtin::BIsinhf: + case Builtin::BIsinhl: + case Builtin::BI__builtin_sinh: + case Builtin::BI__builtin_sinhf: + case Builtin::BI__builtin_sinhl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::sinh)); + case Builtin::BIsqrt: case Builtin::BIsqrtf: case Builtin::BIsqrtl: @@ -1651,6 +1739,30 @@ case Builtin::BI__builtin_sqrtl: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::sqrt)); + case Builtin::BItan: + case Builtin::BItanf: + case Builtin::BItanl: + case Builtin::BI__builtin_tan: + case Builtin::BI__builtin_tanf: + case Builtin::BI__builtin_tanl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::tan)); + + case Builtin::BItanh: + case Builtin::BItanhf: + case Builtin::BItanhl: + case Builtin::BI__builtin_tanh: + case Builtin::BI__builtin_tanhf: + case Builtin::BI__builtin_tanhl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::tanh)); + + case Builtin::BItgamma: + case Builtin::BItgammaf: + case Builtin::BItgammal: + case Builtin::BI__builtin_tgamma: + case Builtin::BI__builtin_tgammaf: + case Builtin::BI__builtin_tgammal: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::tgamma)); + case Builtin::BItrunc: case Builtin::BItruncf: case Builtin::BItruncl: Index: lib/Frontend/CompilerInvocation.cpp =================================================================== --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -669,6 +669,8 @@ Opts.setVecLib(CodeGenOptions::Accelerate); else if (Name == "SVML") Opts.setVecLib(CodeGenOptions::SVML); + else if (Name == "SLEEF") // Experimental for now. + Opts.setVecLib(CodeGenOptions::SLEEF); else if (Name == "none") Opts.setVecLib(CodeGenOptions::NoLibrary); else Index: lib/Index/CommentToXML.cpp =================================================================== --- lib/Index/CommentToXML.cpp +++ lib/Index/CommentToXML.cpp @@ -227,27 +227,27 @@ { } // Inline content. - void visitTextComment(const TextComment *C); - void visitInlineCommandComment(const InlineCommandComment *C); - void visitHTMLStartTagComment(const HTMLStartTagComment *C); - void visitHTMLEndTagComment(const HTMLEndTagComment *C); + void VisitTextComment(const TextComment *C); + void VisitInlineCommandComment(const InlineCommandComment *C); + void VisitHTMLStartTagComment(const HTMLStartTagComment *C); + void VisitHTMLEndTagComment(const HTMLEndTagComment *C); // Block content. - void visitParagraphComment(const ParagraphComment *C); - void visitBlockCommandComment(const BlockCommandComment *C); - void visitParamCommandComment(const ParamCommandComment *C); - void visitTParamCommandComment(const TParamCommandComment *C); - void visitVerbatimBlockComment(const VerbatimBlockComment *C); - void visitVerbatimBlockLineComment(const VerbatimBlockLineComment *C); - void visitVerbatimLineComment(const VerbatimLineComment *C); + void VisitParagraphComment(const ParagraphComment *C); + void VisitBlockCommandComment(const BlockCommandComment *C); + void VisitParamCommandComment(const ParamCommandComment *C); + void VisitTParamCommandComment(const TParamCommandComment *C); + void VisitVerbatimBlockComment(const VerbatimBlockComment *C); + void VisitVerbatimBlockLineComment(const VerbatimBlockLineComment *C); + void VisitVerbatimLineComment(const VerbatimLineComment *C); - void visitFullComment(const FullComment *C); + void VisitFullComment(const FullComment *C); // Helpers. /// Convert a paragraph that is not a block by itself (an argument to some /// command). - void visitNonStandaloneParagraphComment(const ParagraphComment *C); + void VisitNonStandaloneParagraphComment(const ParagraphComment *C); void appendToResultWithHTMLEscaping(StringRef S); @@ -260,11 +260,11 @@ }; } // end unnamed namespace -void CommentASTToHTMLConverter::visitTextComment(const TextComment *C) { +void CommentASTToHTMLConverter::VisitTextComment(const TextComment *C) { appendToResultWithHTMLEscaping(C->getText()); } -void CommentASTToHTMLConverter::visitInlineCommandComment( +void CommentASTToHTMLConverter::VisitInlineCommandComment( const InlineCommandComment *C) { // Nothing to render if no arguments supplied. if (C->getNumArgs() == 0) @@ -304,17 +304,17 @@ } } -void CommentASTToHTMLConverter::visitHTMLStartTagComment( +void CommentASTToHTMLConverter::VisitHTMLStartTagComment( const HTMLStartTagComment *C) { printHTMLStartTagComment(C, Result); } -void CommentASTToHTMLConverter::visitHTMLEndTagComment( +void CommentASTToHTMLConverter::VisitHTMLEndTagComment( const HTMLEndTagComment *C) { Result << "getTagName() << ">"; } -void CommentASTToHTMLConverter::visitParagraphComment( +void CommentASTToHTMLConverter::VisitParagraphComment( const ParagraphComment *C) { if (C->isWhitespace()) return; @@ -327,19 +327,19 @@ Result << "

"; } -void CommentASTToHTMLConverter::visitBlockCommandComment( +void CommentASTToHTMLConverter::VisitBlockCommandComment( const BlockCommandComment *C) { const CommandInfo *Info = Traits.getCommandInfo(C->getCommandID()); if (Info->IsBriefCommand) { Result << "

"; - visitNonStandaloneParagraphComment(C->getParagraph()); + VisitNonStandaloneParagraphComment(C->getParagraph()); Result << "

"; return; } if (Info->IsReturnsCommand) { Result << "

" "Returns "; - visitNonStandaloneParagraphComment(C->getParagraph()); + VisitNonStandaloneParagraphComment(C->getParagraph()); Result << "

"; return; } @@ -347,7 +347,7 @@ visit(C->getParagraph()); } -void CommentASTToHTMLConverter::visitParamCommandComment( +void CommentASTToHTMLConverter::VisitParamCommandComment( const ParamCommandComment *C) { if (C->isParamIndexValid()) { if (C->isVarArgParam()) { @@ -375,11 +375,11 @@ } else Result << "
"; - visitNonStandaloneParagraphComment(C->getParagraph()); + VisitNonStandaloneParagraphComment(C->getParagraph()); Result << "
"; } -void CommentASTToHTMLConverter::visitTParamCommandComment( +void CommentASTToHTMLConverter::VisitTParamCommandComment( const TParamCommandComment *C) { if (C->isPositionValid()) { if (C->getDepth() == 1) @@ -406,11 +406,11 @@ } else Result << "
"; - visitNonStandaloneParagraphComment(C->getParagraph()); + VisitNonStandaloneParagraphComment(C->getParagraph()); Result << "
"; } -void CommentASTToHTMLConverter::visitVerbatimBlockComment( +void CommentASTToHTMLConverter::VisitVerbatimBlockComment( const VerbatimBlockComment *C) { unsigned NumLines = C->getNumLines(); if (NumLines == 0) @@ -425,19 +425,19 @@ Result << ""; } -void CommentASTToHTMLConverter::visitVerbatimBlockLineComment( +void CommentASTToHTMLConverter::VisitVerbatimBlockLineComment( const VerbatimBlockLineComment *C) { llvm_unreachable("should not see this AST node"); } -void CommentASTToHTMLConverter::visitVerbatimLineComment( +void CommentASTToHTMLConverter::VisitVerbatimLineComment( const VerbatimLineComment *C) { Result << "
";
   appendToResultWithHTMLEscaping(C->getText());
   Result << "
"; } -void CommentASTToHTMLConverter::visitFullComment(const FullComment *C) { +void CommentASTToHTMLConverter::VisitFullComment(const FullComment *C) { FullCommentParts Parts(C, Traits); bool FirstParagraphIsBrief = false; @@ -447,7 +447,7 @@ visit(Parts.Brief); else if (Parts.FirstParagraph) { Result << "

"; - visitNonStandaloneParagraphComment(Parts.FirstParagraph); + VisitNonStandaloneParagraphComment(Parts.FirstParagraph); Result << "

"; FirstParagraphIsBrief = true; } @@ -482,7 +482,7 @@ } -void CommentASTToHTMLConverter::visitNonStandaloneParagraphComment( +void CommentASTToHTMLConverter::VisitNonStandaloneParagraphComment( const ParagraphComment *C) { if (!C) return; @@ -534,25 +534,25 @@ FC(FC), Result(Str), Traits(Traits), SM(SM) { } // Inline content. - void visitTextComment(const TextComment *C); - void visitInlineCommandComment(const InlineCommandComment *C); - void visitHTMLStartTagComment(const HTMLStartTagComment *C); - void visitHTMLEndTagComment(const HTMLEndTagComment *C); + void VisitTextComment(const TextComment *C); + void VisitInlineCommandComment(const InlineCommandComment *C); + void VisitHTMLStartTagComment(const HTMLStartTagComment *C); + void VisitHTMLEndTagComment(const HTMLEndTagComment *C); // Block content. - void visitParagraphComment(const ParagraphComment *C); + void VisitParagraphComment(const ParagraphComment *C); void appendParagraphCommentWithKind(const ParagraphComment *C, StringRef Kind); - void visitBlockCommandComment(const BlockCommandComment *C); - void visitParamCommandComment(const ParamCommandComment *C); - void visitTParamCommandComment(const TParamCommandComment *C); - void visitVerbatimBlockComment(const VerbatimBlockComment *C); - void visitVerbatimBlockLineComment(const VerbatimBlockLineComment *C); - void visitVerbatimLineComment(const VerbatimLineComment *C); + void VisitBlockCommandComment(const BlockCommandComment *C); + void VisitParamCommandComment(const ParamCommandComment *C); + void VisitTParamCommandComment(const TParamCommandComment *C); + void VisitVerbatimBlockComment(const VerbatimBlockComment *C); + void VisitVerbatimBlockLineComment(const VerbatimBlockLineComment *C); + void VisitVerbatimLineComment(const VerbatimLineComment *C); - void visitFullComment(const FullComment *C); + void VisitFullComment(const FullComment *C); // Helpers. void appendToResultWithXMLEscaping(StringRef S); @@ -605,11 +605,11 @@ } // end unnamed namespace -void CommentASTToXMLConverter::visitTextComment(const TextComment *C) { +void CommentASTToXMLConverter::VisitTextComment(const TextComment *C) { appendToResultWithXMLEscaping(C->getText()); } -void CommentASTToXMLConverter::visitInlineCommandComment( +void CommentASTToXMLConverter::VisitInlineCommandComment( const InlineCommandComment *C) { // Nothing to render if no arguments supplied. if (C->getNumArgs() == 0) @@ -648,7 +648,7 @@ } } -void CommentASTToXMLConverter::visitHTMLStartTagComment( +void CommentASTToXMLConverter::VisitHTMLStartTagComment( const HTMLStartTagComment *C) { Result << "isMalformed()) @@ -666,7 +666,7 @@ } void -CommentASTToXMLConverter::visitHTMLEndTagComment(const HTMLEndTagComment *C) { +CommentASTToXMLConverter::VisitHTMLEndTagComment(const HTMLEndTagComment *C) { Result << "isMalformed()) Result << " isMalformed=\"1\""; @@ -674,7 +674,7 @@ } void -CommentASTToXMLConverter::visitParagraphComment(const ParagraphComment *C) { +CommentASTToXMLConverter::VisitParagraphComment(const ParagraphComment *C) { appendParagraphCommentWithKind(C, StringRef()); } @@ -696,7 +696,7 @@ Result << ""; } -void CommentASTToXMLConverter::visitBlockCommandComment( +void CommentASTToXMLConverter::VisitBlockCommandComment( const BlockCommandComment *C) { StringRef ParagraphKind; @@ -728,7 +728,7 @@ appendParagraphCommentWithKind(C->getParagraph(), ParagraphKind); } -void CommentASTToXMLConverter::visitParamCommandComment( +void CommentASTToXMLConverter::VisitParamCommandComment( const ParamCommandComment *C) { Result << ""; appendToResultWithXMLEscaping(C->isParamIndexValid() @@ -760,7 +760,7 @@ Result << ""; } -void CommentASTToXMLConverter::visitTParamCommandComment( +void CommentASTToXMLConverter::VisitTParamCommandComment( const TParamCommandComment *C) { Result << ""; appendToResultWithXMLEscaping(C->isPositionValid() ? C->getParamName(FC) @@ -776,7 +776,7 @@ Result << ""; } -void CommentASTToXMLConverter::visitVerbatimBlockComment( +void CommentASTToXMLConverter::VisitVerbatimBlockComment( const VerbatimBlockComment *C) { unsigned NumLines = C->getNumLines(); if (NumLines == 0) @@ -798,19 +798,19 @@ Result << ""; } -void CommentASTToXMLConverter::visitVerbatimBlockLineComment( +void CommentASTToXMLConverter::VisitVerbatimBlockLineComment( const VerbatimBlockLineComment *C) { llvm_unreachable("should not see this AST node"); } -void CommentASTToXMLConverter::visitVerbatimLineComment( +void CommentASTToXMLConverter::VisitVerbatimLineComment( const VerbatimLineComment *C) { Result << ""; appendToResultWithXMLEscaping(C->getText()); Result << ""; } -void CommentASTToXMLConverter::visitFullComment(const FullComment *C) { +void CommentASTToXMLConverter::VisitFullComment(const FullComment *C) { FullCommentParts Parts(C, Traits); const DeclInfo *DI = C->getDeclInfo();