[PATCH] D48989: -fdebug-prefix-map option for cc1as
starsid created this revision. starsid added a reviewer: compnerd. Herald added a subscriber: cfe-commits. Depends on https://reviews.llvm.org/D48988. Repository: rC Clang https://reviews.llvm.org/D48989 Files: lib/Driver/ToolChains/Clang.cpp tools/driver/cc1as_main.cpp Index: tools/driver/cc1as_main.cpp === --- tools/driver/cc1as_main.cpp +++ tools/driver/cc1as_main.cpp @@ -94,6 +94,7 @@ std::string DwarfDebugFlags; std::string DwarfDebugProducer; std::string DebugCompilationDir; + std::map DebugPrefixMap; llvm::DebugCompressionType CompressDebugSections = llvm::DebugCompressionType::None; std::string MainFileName; @@ -233,6 +234,9 @@ Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir); Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name); + for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) +Opts.DebugPrefixMap.insert(StringRef(Arg).split('=')); + // Frontend Options if (Args.hasArg(OPT_INPUT)) { bool First = true; @@ -377,6 +381,9 @@ Ctx.setDwarfDebugProducer(StringRef(Opts.DwarfDebugProducer)); if (!Opts.DebugCompilationDir.empty()) Ctx.setCompilationDir(Opts.DebugCompilationDir); + if (!Opts.DebugPrefixMap.empty()) +for (const auto &KV : Opts.DebugPrefixMap) + Ctx.addDebugPrefixMapEntry(KV.first, KV.second); if (!Opts.MainFileName.empty()) Ctx.setMainFileName(StringRef(Opts.MainFileName)); Ctx.setDwarfVersion(Opts.DwarfVersion); Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -600,6 +600,18 @@ } } +/// Add a CC1 and CC1AS option to specify the debug file path prefix map. +static void addDebugPrefixMapArg(const Driver& D, const ArgList &Args, ArgStringList &CmdArgs) { + for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) { +StringRef Map = A->getValue(); +if (Map.find('=') == StringRef::npos) + D.Diag(diag::err_drv_invalid_argument_to_fdebug_prefix_map) << Map; +else + CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); +A->claim(); + } +} + /// Vectorize at all optimization levels greater than 1 except for -Oz. /// For -Oz the loop vectorizer is disable, while the slp vectorizer is enabled. static bool shouldEnableVectorizerAtOLevel(const ArgList &Args, bool isSlpVec) { @@ -3849,14 +3861,7 @@ // Add in -fdebug-compilation-dir if necessary. addDebugCompDirArg(Args, CmdArgs); - for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) { -StringRef Map = A->getValue(); -if (Map.find('=') == StringRef::npos) - D.Diag(diag::err_drv_invalid_argument_to_fdebug_prefix_map) << Map; -else - CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); -A->claim(); - } + addDebugPrefixMapArg(D, Args, CmdArgs); if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_, options::OPT_ftemplate_depth_EQ)) { @@ -5409,6 +5414,8 @@ // Add the -fdebug-compilation-dir flag if needed. addDebugCompDirArg(Args, CmdArgs); +addDebugPrefixMapArg(getToolChain().getDriver(), Args, CmdArgs); + // Set the AT_producer to the clang version when using the integrated // assembler on assembly source files. CmdArgs.push_back("-dwarf-debug-producer"); Index: tools/driver/cc1as_main.cpp === --- tools/driver/cc1as_main.cpp +++ tools/driver/cc1as_main.cpp @@ -94,6 +94,7 @@ std::string DwarfDebugFlags; std::string DwarfDebugProducer; std::string DebugCompilationDir; + std::map DebugPrefixMap; llvm::DebugCompressionType CompressDebugSections = llvm::DebugCompressionType::None; std::string MainFileName; @@ -233,6 +234,9 @@ Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir); Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name); + for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) +Opts.DebugPrefixMap.insert(StringRef(Arg).split('=')); + // Frontend Options if (Args.hasArg(OPT_INPUT)) { bool First = true; @@ -377,6 +381,9 @@ Ctx.setDwarfDebugProducer(StringRef(Opts.DwarfDebugProducer)); if (!Opts.DebugCompilationDir.empty()) Ctx.setCompilationDir(Opts.DebugCompilationDir); + if (!Opts.DebugPrefixMap.empty()) +for (const auto &KV : Opts.DebugPrefixMap) + Ctx.addDebugPrefixMapEntry(KV.first, KV.second); if (!Opts.MainFileName.empty()) Ctx.setMainFileName(StringRef(Opts.MainFileName)); Ctx.setDwarfVersion(Opts.DwarfVersion); Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -600,6 +600,18 @@
[PATCH] D48989: -fdebug-prefix-map option for cc1as
starsid updated this revision to Diff 154285. starsid added a comment. include generator input file for flag property change Repository: rC Clang https://reviews.llvm.org/D48989 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp tools/driver/cc1as_main.cpp Index: tools/driver/cc1as_main.cpp === --- tools/driver/cc1as_main.cpp +++ tools/driver/cc1as_main.cpp @@ -94,6 +94,7 @@ std::string DwarfDebugFlags; std::string DwarfDebugProducer; std::string DebugCompilationDir; + std::map DebugPrefixMap; llvm::DebugCompressionType CompressDebugSections = llvm::DebugCompressionType::None; std::string MainFileName; @@ -233,6 +234,9 @@ Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir); Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name); + for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) +Opts.DebugPrefixMap.insert(StringRef(Arg).split('=')); + // Frontend Options if (Args.hasArg(OPT_INPUT)) { bool First = true; @@ -377,6 +381,9 @@ Ctx.setDwarfDebugProducer(StringRef(Opts.DwarfDebugProducer)); if (!Opts.DebugCompilationDir.empty()) Ctx.setCompilationDir(Opts.DebugCompilationDir); + if (!Opts.DebugPrefixMap.empty()) +for (const auto &KV : Opts.DebugPrefixMap) + Ctx.addDebugPrefixMapEntry(KV.first, KV.second); if (!Opts.MainFileName.empty()) Ctx.setMainFileName(StringRef(Opts.MainFileName)); Ctx.setDwarfVersion(Opts.DwarfVersion); Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -600,6 +600,18 @@ } } +/// Add a CC1 and CC1AS option to specify the debug file path prefix map. +static void addDebugPrefixMapArg(const Driver& D, const ArgList &Args, ArgStringList &CmdArgs) { + for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) { +StringRef Map = A->getValue(); +if (Map.find('=') == StringRef::npos) + D.Diag(diag::err_drv_invalid_argument_to_fdebug_prefix_map) << Map; +else + CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); +A->claim(); + } +} + /// Vectorize at all optimization levels greater than 1 except for -Oz. /// For -Oz the loop vectorizer is disable, while the slp vectorizer is enabled. static bool shouldEnableVectorizerAtOLevel(const ArgList &Args, bool isSlpVec) { @@ -3849,14 +3861,7 @@ // Add in -fdebug-compilation-dir if necessary. addDebugCompDirArg(Args, CmdArgs); - for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) { -StringRef Map = A->getValue(); -if (Map.find('=') == StringRef::npos) - D.Diag(diag::err_drv_invalid_argument_to_fdebug_prefix_map) << Map; -else - CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); -A->claim(); - } + addDebugPrefixMapArg(D, Args, CmdArgs); if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_, options::OPT_ftemplate_depth_EQ)) { @@ -5409,6 +5414,8 @@ // Add the -fdebug-compilation-dir flag if needed. addDebugCompDirArg(Args, CmdArgs); +addDebugPrefixMapArg(getToolChain().getDriver(), Args, CmdArgs); + // Set the AT_producer to the clang version when using the integrated // assembler on assembly source files. CmdArgs.push_back("-dwarf-debug-producer"); Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1740,7 +1740,8 @@ def fno_split_dwarf_inlining: Flag<["-"], "fno-split-dwarf-inlining">, Group, Flags<[CC1Option]>; def fdebug_prefix_map_EQ - : Joined<["-"], "fdebug-prefix-map=">, Group, Flags<[CC1Option]>, + : Joined<["-"], "fdebug-prefix-map=">, Group, +Flags<[CC1Option,CC1AsOption]>, HelpText<"remap file source paths in debug info">; def g_Flag : Flag<["-"], "g">, Group, HelpText<"Generate source-level debug information">; Index: tools/driver/cc1as_main.cpp === --- tools/driver/cc1as_main.cpp +++ tools/driver/cc1as_main.cpp @@ -94,6 +94,7 @@ std::string DwarfDebugFlags; std::string DwarfDebugProducer; std::string DebugCompilationDir; + std::map DebugPrefixMap; llvm::DebugCompressionType CompressDebugSections = llvm::DebugCompressionType::None; std::string MainFileName; @@ -233,6 +234,9 @@ Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir); Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name); + for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) +Opts.DebugPrefixMap.insert(StringRef(Arg).split('=')); + // Frontend Options if (Args.hasArg(OPT_INPUT)) { bool First = true; @@ -377,6 +381
[PATCH] D48989: -fdebug-prefix-map option for cc1as
starsid updated this revision to Diff 154354. starsid added a comment. add a test for the Driver passing the new flag Repository: rC Clang https://reviews.llvm.org/D48989 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp test/Driver/debug-prefix-map.S tools/driver/cc1as_main.cpp Index: tools/driver/cc1as_main.cpp === --- tools/driver/cc1as_main.cpp +++ tools/driver/cc1as_main.cpp @@ -94,6 +94,7 @@ std::string DwarfDebugFlags; std::string DwarfDebugProducer; std::string DebugCompilationDir; + std::map DebugPrefixMap; llvm::DebugCompressionType CompressDebugSections = llvm::DebugCompressionType::None; std::string MainFileName; @@ -233,6 +234,9 @@ Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir); Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name); + for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) +Opts.DebugPrefixMap.insert(StringRef(Arg).split('=')); + // Frontend Options if (Args.hasArg(OPT_INPUT)) { bool First = true; @@ -377,6 +381,9 @@ Ctx.setDwarfDebugProducer(StringRef(Opts.DwarfDebugProducer)); if (!Opts.DebugCompilationDir.empty()) Ctx.setCompilationDir(Opts.DebugCompilationDir); + if (!Opts.DebugPrefixMap.empty()) +for (const auto &KV : Opts.DebugPrefixMap) + Ctx.addDebugPrefixMapEntry(KV.first, KV.second); if (!Opts.MainFileName.empty()) Ctx.setMainFileName(StringRef(Opts.MainFileName)); Ctx.setDwarfVersion(Opts.DwarfVersion); Index: test/Driver/debug-prefix-map.S === --- /dev/null +++ test/Driver/debug-prefix-map.S @@ -0,0 +1,5 @@ +// RUN: %clang -### -g -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s + +// CHECK: fdebug-prefix-map=old=new + +// More tests for this flag in debug-prefix-map.c. Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -600,6 +600,18 @@ } } +/// Add a CC1 and CC1AS option to specify the debug file path prefix map. +static void addDebugPrefixMapArg(const Driver &D, const ArgList &Args, ArgStringList &CmdArgs) { + for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) { +StringRef Map = A->getValue(); +if (Map.find('=') == StringRef::npos) + D.Diag(diag::err_drv_invalid_argument_to_fdebug_prefix_map) << Map; +else + CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); +A->claim(); + } +} + /// Vectorize at all optimization levels greater than 1 except for -Oz. /// For -Oz the loop vectorizer is disable, while the slp vectorizer is enabled. static bool shouldEnableVectorizerAtOLevel(const ArgList &Args, bool isSlpVec) { @@ -3849,14 +3861,7 @@ // Add in -fdebug-compilation-dir if necessary. addDebugCompDirArg(Args, CmdArgs); - for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) { -StringRef Map = A->getValue(); -if (Map.find('=') == StringRef::npos) - D.Diag(diag::err_drv_invalid_argument_to_fdebug_prefix_map) << Map; -else - CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); -A->claim(); - } + addDebugPrefixMapArg(D, Args, CmdArgs); if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_, options::OPT_ftemplate_depth_EQ)) { @@ -5409,6 +5414,8 @@ // Add the -fdebug-compilation-dir flag if needed. addDebugCompDirArg(Args, CmdArgs); +addDebugPrefixMapArg(getToolChain().getDriver(), Args, CmdArgs); + // Set the AT_producer to the clang version when using the integrated // assembler on assembly source files. CmdArgs.push_back("-dwarf-debug-producer"); Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1740,7 +1740,8 @@ def fno_split_dwarf_inlining: Flag<["-"], "fno-split-dwarf-inlining">, Group, Flags<[CC1Option]>; def fdebug_prefix_map_EQ - : Joined<["-"], "fdebug-prefix-map=">, Group, Flags<[CC1Option]>, + : Joined<["-"], "fdebug-prefix-map=">, Group, +Flags<[CC1Option,CC1AsOption]>, HelpText<"remap file source paths in debug info">; def g_Flag : Flag<["-"], "g">, Group, HelpText<"Generate source-level debug information">; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48989: -fdebug-prefix-map option for cc1as
starsid added a comment. In https://reviews.llvm.org/D48989#1153773, @compnerd wrote: > However, please add a test to ensure that the paths are mapped when invoking > the assembler I added the tests to check the mapping logic through llvm-mc in https://reviews.llvm.org/D48988. In this revision, I merely test if the driver is passing the flags to cc1as. The only thing that is untested is if cc1as_main is setting the options in MCContext correctly. If you want to see a test for that, please can you guide me a little on an appropriate way to test this within tools/clang/test. Repository: rC Clang https://reviews.llvm.org/D48989 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48989: -fdebug-prefix-map option for cc1as
starsid updated this revision to Diff 154669. starsid marked an inline comment as done. starsid added a comment. Test improvements Repository: rC Clang https://reviews.llvm.org/D48989 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp test/Driver/debug-prefix-map.S tools/driver/cc1as_main.cpp Index: tools/driver/cc1as_main.cpp === --- tools/driver/cc1as_main.cpp +++ tools/driver/cc1as_main.cpp @@ -94,6 +94,7 @@ std::string DwarfDebugFlags; std::string DwarfDebugProducer; std::string DebugCompilationDir; + std::map DebugPrefixMap; llvm::DebugCompressionType CompressDebugSections = llvm::DebugCompressionType::None; std::string MainFileName; @@ -233,6 +234,9 @@ Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir); Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name); + for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) +Opts.DebugPrefixMap.insert(StringRef(Arg).split('=')); + // Frontend Options if (Args.hasArg(OPT_INPUT)) { bool First = true; @@ -377,6 +381,9 @@ Ctx.setDwarfDebugProducer(StringRef(Opts.DwarfDebugProducer)); if (!Opts.DebugCompilationDir.empty()) Ctx.setCompilationDir(Opts.DebugCompilationDir); + if (!Opts.DebugPrefixMap.empty()) +for (const auto &KV : Opts.DebugPrefixMap) + Ctx.addDebugPrefixMapEntry(KV.first, KV.second); if (!Opts.MainFileName.empty()) Ctx.setMainFileName(StringRef(Opts.MainFileName)); Ctx.setDwarfVersion(Opts.DwarfVersion); Index: test/Driver/debug-prefix-map.S === --- /dev/null +++ test/Driver/debug-prefix-map.S @@ -0,0 +1,6 @@ +// RUN: %clang -### -g -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s + +// CHECK: cc1as +// CHECK-SAME: -fdebug-prefix-map=old=new + +// More tests for this flag in debug-prefix-map.c. Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -600,6 +600,18 @@ } } +/// Add a CC1 and CC1AS option to specify the debug file path prefix map. +static void addDebugPrefixMapArg(const Driver &D, const ArgList &Args, ArgStringList &CmdArgs) { + for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) { +StringRef Map = A->getValue(); +if (Map.find('=') == StringRef::npos) + D.Diag(diag::err_drv_invalid_argument_to_fdebug_prefix_map) << Map; +else + CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); +A->claim(); + } +} + /// Vectorize at all optimization levels greater than 1 except for -Oz. /// For -Oz the loop vectorizer is disable, while the slp vectorizer is enabled. static bool shouldEnableVectorizerAtOLevel(const ArgList &Args, bool isSlpVec) { @@ -3800,14 +3812,7 @@ // Add in -fdebug-compilation-dir if necessary. addDebugCompDirArg(Args, CmdArgs); - for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) { -StringRef Map = A->getValue(); -if (Map.find('=') == StringRef::npos) - D.Diag(diag::err_drv_invalid_argument_to_fdebug_prefix_map) << Map; -else - CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); -A->claim(); - } + addDebugPrefixMapArg(D, Args, CmdArgs); if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_, options::OPT_ftemplate_depth_EQ)) { @@ -5352,6 +5357,8 @@ // Add the -fdebug-compilation-dir flag if needed. addDebugCompDirArg(Args, CmdArgs); +addDebugPrefixMapArg(getToolChain().getDriver(), Args, CmdArgs); + // Set the AT_producer to the clang version when using the integrated // assembler on assembly source files. CmdArgs.push_back("-dwarf-debug-producer"); Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1740,7 +1740,8 @@ def fno_split_dwarf_inlining: Flag<["-"], "fno-split-dwarf-inlining">, Group, Flags<[CC1Option]>; def fdebug_prefix_map_EQ - : Joined<["-"], "fdebug-prefix-map=">, Group, Flags<[CC1Option]>, + : Joined<["-"], "fdebug-prefix-map=">, Group, +Flags<[CC1Option,CC1AsOption]>, HelpText<"remap file source paths in debug info">; def g_Flag : Flag<["-"], "g">, Group, HelpText<"Generate source-level debug information">; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.
starsid updated this revision to Diff 393335. starsid added a comment. rebase and resurrect Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D53608/new/ https://reviews.llvm.org/D53608 Files: compiler-rt/lib/builtins/extendhftf2.c compiler-rt/lib/builtins/fp_lib.h compiler-rt/lib/builtins/powitf2.c compiler-rt/lib/builtins/trunctfdf2.c compiler-rt/lib/builtins/trunctfhf2.c compiler-rt/lib/builtins/trunctfsf2.c Index: compiler-rt/lib/builtins/trunctfsf2.c === --- compiler-rt/lib/builtins/trunctfsf2.c +++ compiler-rt/lib/builtins/trunctfsf2.c @@ -14,6 +14,6 @@ #define DST_SINGLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI float __trunctfsf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI float __trunctfsf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfhf2.c === --- compiler-rt/lib/builtins/trunctfhf2.c +++ compiler-rt/lib/builtins/trunctfhf2.c @@ -16,8 +16,6 @@ #define DST_HALF #include "fp_trunc_impl.inc" -COMPILER_RT_ABI _Float16 __trunctfhf2(long double a) { - return __truncXfYf2__(a); -} +COMPILER_RT_ABI _Float16 __trunctfhf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfdf2.c === --- compiler-rt/lib/builtins/trunctfdf2.c +++ compiler-rt/lib/builtins/trunctfdf2.c @@ -14,6 +14,6 @@ #define DST_DOUBLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI double __trunctfdf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI double __trunctfdf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/powitf2.c === --- compiler-rt/lib/builtins/powitf2.c +++ compiler-rt/lib/builtins/powitf2.c @@ -17,9 +17,9 @@ // Returns: a ^ b -COMPILER_RT_ABI long double __powitf2(long double a, int b) { +COMPILER_RT_ABI fp_t __powitf2(fp_t a, int b) { const int recip = b < 0; - long double r = 1; + fp_t r = 1; while (1) { if (b & 1) r *= a; Index: compiler-rt/lib/builtins/fp_lib.h === --- compiler-rt/lib/builtins/fp_lib.h +++ compiler-rt/lib/builtins/fp_lib.h @@ -105,12 +105,17 @@ COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b); #elif defined QUAD_PRECISION -#if __LDBL_MANT_DIG__ == 113 && defined(__SIZEOF_INT128__) +#if (__LDBL_MANT_DIG__ == 113 || defined(__x86_64__)) && \ +defined(__SIZEOF_INT128__) #define CRT_LDBL_128BIT typedef uint64_t half_rep_t; typedef __uint128_t rep_t; typedef __int128_t srep_t; +#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) +typedef __float128 fp_t; +#else typedef long double fp_t; +#endif #define HALF_REP_C UINT64_C #define REP_C (__uint128_t) // Note: Since there is no explicit way to tell compiler the constant is a Index: compiler-rt/lib/builtins/extendhftf2.c === --- compiler-rt/lib/builtins/extendhftf2.c +++ compiler-rt/lib/builtins/extendhftf2.c @@ -16,8 +16,6 @@ #define DST_QUAD #include "fp_extend_impl.inc" -COMPILER_RT_ABI long double __extendhftf2(_Float16 a) { - return __extendXfYf2__(a); -} +COMPILER_RT_ABI fp_t __extendhftf2(_Float16 a) { return __extendXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfsf2.c === --- compiler-rt/lib/builtins/trunctfsf2.c +++ compiler-rt/lib/builtins/trunctfsf2.c @@ -14,6 +14,6 @@ #define DST_SINGLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI float __trunctfsf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI float __trunctfsf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfhf2.c === --- compiler-rt/lib/builtins/trunctfhf2.c +++ compiler-rt/lib/builtins/trunctfhf2.c @@ -16,8 +16,6 @@ #define DST_HALF #include "fp_trunc_impl.inc" -COMPILER_RT_ABI _Float16 __trunctfhf2(long double a) { - return __truncXfYf2__(a); -} +COMPILER_RT_ABI _Float16 __trunctfhf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfdf2.c === --- compiler-rt/lib/builtins/trunctfdf2.c +++ compiler-rt/lib/builtins/trunctfdf2.c @@ -14,6 +14,6 @@ #define DST_DOUBLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI double __trunctfdf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI double __trunctfdf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/powitf2.c === --- compiler-rt/lib/builtins/powitf2.c +++ compiler-rt/lib/built
[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.
starsid updated this revision to Diff 393340. starsid added a comment. fix commit author name and email Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D53608/new/ https://reviews.llvm.org/D53608 Files: compiler-rt/lib/builtins/extendhftf2.c compiler-rt/lib/builtins/fp_lib.h compiler-rt/lib/builtins/powitf2.c compiler-rt/lib/builtins/trunctfdf2.c compiler-rt/lib/builtins/trunctfhf2.c compiler-rt/lib/builtins/trunctfsf2.c Index: compiler-rt/lib/builtins/trunctfsf2.c === --- compiler-rt/lib/builtins/trunctfsf2.c +++ compiler-rt/lib/builtins/trunctfsf2.c @@ -14,6 +14,6 @@ #define DST_SINGLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI float __trunctfsf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI float __trunctfsf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfhf2.c === --- compiler-rt/lib/builtins/trunctfhf2.c +++ compiler-rt/lib/builtins/trunctfhf2.c @@ -16,8 +16,6 @@ #define DST_HALF #include "fp_trunc_impl.inc" -COMPILER_RT_ABI _Float16 __trunctfhf2(long double a) { - return __truncXfYf2__(a); -} +COMPILER_RT_ABI _Float16 __trunctfhf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfdf2.c === --- compiler-rt/lib/builtins/trunctfdf2.c +++ compiler-rt/lib/builtins/trunctfdf2.c @@ -14,6 +14,6 @@ #define DST_DOUBLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI double __trunctfdf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI double __trunctfdf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/powitf2.c === --- compiler-rt/lib/builtins/powitf2.c +++ compiler-rt/lib/builtins/powitf2.c @@ -17,9 +17,9 @@ // Returns: a ^ b -COMPILER_RT_ABI long double __powitf2(long double a, int b) { +COMPILER_RT_ABI fp_t __powitf2(fp_t a, int b) { const int recip = b < 0; - long double r = 1; + fp_t r = 1; while (1) { if (b & 1) r *= a; Index: compiler-rt/lib/builtins/fp_lib.h === --- compiler-rt/lib/builtins/fp_lib.h +++ compiler-rt/lib/builtins/fp_lib.h @@ -105,12 +105,17 @@ COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b); #elif defined QUAD_PRECISION -#if __LDBL_MANT_DIG__ == 113 && defined(__SIZEOF_INT128__) +#if (__LDBL_MANT_DIG__ == 113 || defined(__x86_64__)) && \ +defined(__SIZEOF_INT128__) #define CRT_LDBL_128BIT typedef uint64_t half_rep_t; typedef __uint128_t rep_t; typedef __int128_t srep_t; +#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) +typedef __float128 fp_t; +#else typedef long double fp_t; +#endif #define HALF_REP_C UINT64_C #define REP_C (__uint128_t) // Note: Since there is no explicit way to tell compiler the constant is a Index: compiler-rt/lib/builtins/extendhftf2.c === --- compiler-rt/lib/builtins/extendhftf2.c +++ compiler-rt/lib/builtins/extendhftf2.c @@ -16,8 +16,6 @@ #define DST_QUAD #include "fp_extend_impl.inc" -COMPILER_RT_ABI long double __extendhftf2(_Float16 a) { - return __extendXfYf2__(a); -} +COMPILER_RT_ABI fp_t __extendhftf2(_Float16 a) { return __extendXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfsf2.c === --- compiler-rt/lib/builtins/trunctfsf2.c +++ compiler-rt/lib/builtins/trunctfsf2.c @@ -14,6 +14,6 @@ #define DST_SINGLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI float __trunctfsf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI float __trunctfsf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfhf2.c === --- compiler-rt/lib/builtins/trunctfhf2.c +++ compiler-rt/lib/builtins/trunctfhf2.c @@ -16,8 +16,6 @@ #define DST_HALF #include "fp_trunc_impl.inc" -COMPILER_RT_ABI _Float16 __trunctfhf2(long double a) { - return __truncXfYf2__(a); -} +COMPILER_RT_ABI _Float16 __trunctfhf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfdf2.c === --- compiler-rt/lib/builtins/trunctfdf2.c +++ compiler-rt/lib/builtins/trunctfdf2.c @@ -14,6 +14,6 @@ #define DST_DOUBLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI double __trunctfdf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI double __trunctfdf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/powitf2.c === --- compiler-rt/lib/builtins/powitf2.c +++ compiler-
[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.
starsid added a comment. I have tried my best to follow the conversation here and complete this patch. Please let me know if it is missing something, or if I need to assign new reviewers. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D53608/new/ https://reviews.llvm.org/D53608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.
starsid planned changes to this revision. starsid added a comment. Thanks. I missed that in the comment thread. Will send back for review once ready. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D53608/new/ https://reviews.llvm.org/D53608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits