diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2011-08-23 01:14:17 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2011-08-23 01:14:17 +0000 |
commit | 3bde6fe0df05558b89e7edfe48ac05da59beb81a (patch) | |
tree | 011a10aa34d5fb2d2afa5786803bd3f240a9d2a7 /lib/Target/X86/X86TargetMachine.cpp | |
parent | 7e99b5c8a36e3e8d611e47122f9c596b58ccf3e8 (diff) | |
download | llvm-3bde6fe0df05558b89e7edfe48ac05da59beb81a.tar.gz llvm-3bde6fe0df05558b89e7edfe48ac05da59beb81a.tar.bz2 llvm-3bde6fe0df05558b89e7edfe48ac05da59beb81a.tar.xz |
Introduce a pass to insert vzeroupper instructions to avoid AVX to
SSE transition penalty. The pass is enabled through the "x86-use-vzeroupper"
llc command line option. This is only the first step (very naive and
conservative one) to sketch out the idea, but proper DFA is coming next
to allow smarter decisions. Comments and ideas now and in further commits
will be very appreciated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r-- | lib/Target/X86/X86TargetMachine.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 569c0408f3..95e7021dce 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -16,6 +16,7 @@ #include "llvm/PassManager.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/Passes.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegistry.h" @@ -92,6 +93,16 @@ X86TargetMachine::X86TargetMachine(const Target &T, StringRef TT, } //===----------------------------------------------------------------------===// +// Command line options for x86 +//===----------------------------------------------------------------------===// +bool UseVZeroUpper; + +static cl::opt<bool, true> +VZeroUpper("x86-use-vzeroupper", + cl::desc("Minimize AVX to SSE transition penalty"), + cl::location(UseVZeroUpper), cl::init(false)); + +//===----------------------------------------------------------------------===// // Pass Pipeline Configuration //===----------------------------------------------------------------------===// @@ -125,6 +136,11 @@ bool X86TargetMachine::addPreEmitPass(PassManagerBase &PM, PM.add(createSSEDomainFixPass()); return true; } + + if (Subtarget.hasAVX() && UseVZeroUpper) { + PM.add(createX86IssueVZeroUpperPass()); + return true; + } return false; } |