diff options
author | Hal Finkel <hfinkel@anl.gov> | 2015-01-05 18:52:29 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2015-01-05 18:52:29 +0000 |
commit | 49557f1b4293d78c1df9ef8553ef84af96b1a2ec (patch) | |
tree | 7f662fde658d19a7c40d6ffc145d1309712c75e0 /llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | |
parent | 58d4c5a9c0a58c519e1a037f626d3973766032db (diff) | |
download | bcm5719-llvm-49557f1b4293d78c1df9ef8553ef84af96b1a2ec.tar.gz bcm5719-llvm-49557f1b4293d78c1df9ef8553ef84af96b1a2ec.zip |
[PowerPC] Remove zexts after i32 ctlz
The 64-bit semantics of cntlzw are not special, the 32-bit population count is
stored as a 64-bit value in the range [0,32]. As a result, it is always zero
extended, and it can be added to the PPCISelDAGToDAG peephole optimization as a
frontier instruction for the removal of unnecessary zero extensions.
llvm-svn: 225192
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp index 3e787bedd27..ab3a01d6b39 100644 --- a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -3736,6 +3736,12 @@ static bool PeepholePPC64ZExtGather(SDValue Op32, return true; } + // CNTLZW always produces a 64-bit value in [0,32], and so is zero extended. + if (Op32.getMachineOpcode() == PPC::CNTLZW) { + ToPromote.insert(Op32.getNode()); + return true; + } + // Next, check for those instructions we can look through. // Assuming the mask does not wrap around, then the higher-order bits are @@ -3925,6 +3931,7 @@ void PPCDAGToDAGISel::PeepholePPC64ZExt() { case PPC::LIS: NewOpcode = PPC::LIS8; break; case PPC::LHBRX: NewOpcode = PPC::LHBRX8; break; case PPC::LWBRX: NewOpcode = PPC::LWBRX8; break; + case PPC::CNTLZW: NewOpcode = PPC::CNTLZW8; break; case PPC::RLWIMI: NewOpcode = PPC::RLWIMI8; break; case PPC::OR: NewOpcode = PPC::OR8; break; case PPC::SELECT_I4: NewOpcode = PPC::SELECT_I8; break; |