From 5f9688b7c7fdeafdf530056d49f82d2ec6ca457f Mon Sep 17 00:00:00 2001 From: Sirish Pande Date: Thu, 10 May 2012 20:19:54 +0000 Subject: [PATCH] Hexagon V5 FP support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156567 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Options.td | 2 ++ lib/Basic/Targets.cpp | 13 +++++++++++-- lib/Driver/Tools.cpp | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 1868a70fae..62b8d3aa6c 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -37,6 +37,7 @@ def i_Group : OptionGroup<"">, Group; def clang_i_Group : OptionGroup<"">, Group; def m_Group : OptionGroup<"">, Group; def m_x86_Features_Group : OptionGroup<"">, Group; +def m_hexagon_Features_Group : OptionGroup<"">, Group; def u_Group : OptionGroup<"">; def pedantic_Group : OptionGroup<"">, @@ -1098,6 +1099,7 @@ def _warn_ : Joined<"--warn-">, Alias; def _write_dependencies : Flag<"--write-dependencies">, Alias; def _write_user_dependencies : Flag<"--write-user-dependencies">, Alias; def _ : Joined<"--">, Flags<[Unsupported]>; +def mieee_rnd_near : Flag<"-mieee-rnd-near">, Group; // Special internal option to handle -Xlinker --no-demangle. def Z_Xlinker__no_demangle : Flag<"-Z-Xlinker-no-demangle">, diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index e9094bace5..045229e9fb 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -3015,8 +3015,8 @@ public: HexagonTargetInfo(const std::string& triple) : TargetInfo(triple) { BigEndian = false; DescriptionString = ("e-p:32:32:32-" - "i64:64:64-i32:32:32-" - "i16:16:16-i1:32:32-a:0:0"); + "i64:64:64-i32:32:32-i16:16:16-i1:32:32" + "f64:64:64-f32:32:32-a0:0-n32"); // {} in inline assembly are packet specifiers, not assembly variant // specifiers. @@ -3057,6 +3057,7 @@ public: .Case("hexagonv2", "2") .Case("hexagonv3", "3") .Case("hexagonv4", "4") + .Case("hexagonv5", "5") .Default(0); } @@ -3111,6 +3112,14 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__QDSP6_ARCH__", "4"); } } + else if(CPU == "hexagonv5") { + Builder.defineMacro("__HEXAGON_V5__"); + Builder.defineMacro("__HEXAGON_ARCH__", "5"); + if(Opts.HexagonQdsp6Compat) { + Builder.defineMacro("__QDSP6_V5__"); + Builder.defineMacro("__QDSP6_ARCH__", "5"); + } + } } const char * const HexagonTargetInfo::GCCRegNames[] = { diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 10964ecb75..769bd81e43 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1088,7 +1088,7 @@ void Clang::AddHexagonTargetArgs(const ArgList &Args, CmdArgs.push_back("-fno-signed-char"); CmdArgs.push_back("-nobuiltininc"); - if (Args.hasArg(options::OPT_mqdsp6_compat)) + if (Args.hasArg(options::OPT_mqdsp6_compat)) CmdArgs.push_back("-mqdsp6-compat"); if (Arg *A = Args.getLastArg(options::OPT_G, @@ -1100,6 +1100,12 @@ void Clang::AddHexagonTargetArgs(const ArgList &Args, A->claim(); } + if (!Args.hasArg(options::OPT_fno_short_enums)) + CmdArgs.push_back("-fshort-enums"); + if (Args.getLastArg(options::OPT_mieee_rnd_near)) { + CmdArgs.push_back ("-mllvm"); + CmdArgs.push_back ("-enable-hexagon-ieee-rnd-near"); + } CmdArgs.push_back ("-mllvm"); CmdArgs.push_back ("-machine-sink-split=0"); } -- 2.40.0