diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-01-15 21:19:37 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-01-15 21:19:37 +0000 |
| commit | bec03ea725a09c91d13ddc8c4ab63a81762172a3 (patch) | |
| tree | ed76dd1898d5d90be7649146a22f84dc29a161fc /llvm/lib/CodeGen/SelectionDAG | |
| parent | 94b2ab3556a6b4f0f78720f494bdb4cff243c419 (diff) | |
| download | bcm5719-llvm-bec03ea725a09c91d13ddc8c4ab63a81762172a3.tar.gz bcm5719-llvm-bec03ea725a09c91d13ddc8c4ab63a81762172a3.zip | |
Add an assert so we don't silently miscompile ctpop for bit widths > 128.
llvm-svn: 123549
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 3a29424d070..477cf093f10 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -2389,6 +2389,7 @@ SDValue SelectionDAGLegalize::ExpandBSWAP(SDValue Op, DebugLoc dl) { } /// SplatByte - Distribute ByteVal over NumBits bits. +// FIXME: Move this helper to a common place. static APInt SplatByte(unsigned NumBits, uint8_t ByteVal) { APInt Val = APInt(NumBits, ByteVal); unsigned Shift = 8; @@ -2410,6 +2411,9 @@ SDValue SelectionDAGLegalize::ExpandBitCount(unsigned Opc, SDValue Op, EVT ShVT = TLI.getShiftAmountTy(); unsigned Len = VT.getSizeInBits(); + assert(VT.isInteger() && Len <= 128 && Len % 8 == 0 && + "CTPOP not implemented for this type."); + // This is the "best" algorithm from // http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel |

