Skip to content

Enable vectorization of libpgmath intrinsic calls #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ endif()

add_definitions( -D_GNU_SOURCE )

option(FLANG_LLVM_EXTENSIONS "enable the Flang LLVM extensions" OFF)
if(FLANG_LLVM_EXTENSIONS)
add_definitions( -DFLANG_LLVM_EXTENSIONS )
endif()

option(CLANG_BUILD_TOOLS
"Build the Clang tools. If OFF, just generate build targets." ON)

Expand Down
2 changes: 1 addition & 1 deletion include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-m
Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Disables an experimental new pass manager in LLVM.">;
def fveclib : Joined<["-"], "fveclib=">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Use the given vector functions library">, Values<"Accelerate,SVML,none">;
HelpText<"Use the given vector functions library">, Values<"Accelerate,SVML,PGMATH,none">;
def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group<f_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<f_Group>,
Expand Down
3 changes: 2 additions & 1 deletion include/clang/Frontend/CodeGenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class CodeGenOptions : public CodeGenOptionsBase {
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.
PGMATH // PGI math library.
};


Expand Down
3 changes: 3 additions & 0 deletions lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ static TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple,
case CodeGenOptions::SVML:
TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML);
break;
case CodeGenOptions::PGMATH:
TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::PGMATH);
break;
default:
break;
}
Expand Down
7 changes: 7 additions & 0 deletions lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3286,7 +3286,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
else
CmdArgs.push_back(Args.MakeArgString(getToolChain().getThreadModel()));

#ifdef FLANG_LLVM_EXTENSIONS
if(Args.getLastArg(options::OPT_fveclib))
Args.AddLastArg(CmdArgs, options::OPT_fveclib);
else
CmdArgs.push_back("-fveclib=PGMATH");
#else
Args.AddLastArg(CmdArgs, options::OPT_fveclib);
#endif

if (Args.hasFlag(options::OPT_fmerge_all_constants,
options::OPT_fno_merge_all_constants, false))
Expand Down
2 changes: 2 additions & 0 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.setVecLib(CodeGenOptions::Accelerate);
else if (Name == "SVML")
Opts.setVecLib(CodeGenOptions::SVML);
else if (Name == "PGMATH")
Opts.setVecLib(CodeGenOptions::PGMATH);
else if (Name == "none")
Opts.setVecLib(CodeGenOptions::NoLibrary);
else
Expand Down