[llvm-commits] [llvm] r61834 - in /llvm/trunk: include/llvm/DerivedTypes.h include/llvm/Intrinsics.td lib/VMCore/Verifier.cpp utils/TableGen/CodeGenTarget.cpp utils/TableGen/IntrinsicEmitter.cpp
Chris Lattner
clattner at apple.com
Wed Jan 7 20:47:38 PST 2009
On Jan 7, 2009, at 3:44 PM, Bob Wilson wrote:
>
> On Jan 6, 2009, at 5:13 PM, Chris Lattner wrote:
>>
>> On Jan 6, 2009, at 4:09 PM, Bob Wilson wrote:
>>> + /// VectorType::getTruncatedElementVectorType - This static
>>> method is like
>>> + /// getInteger except that the element types are half as wide as
>>> the
>>> + /// elements in the input type.
>>> + ///
>>> + static VectorType *getTruncatedElementVectorType(const VectorType
>>> *VTy) {
>>> + unsigned EltBits = VTy->getElementType()-
>>>> getPrimitiveSizeInBits();
>>> + const Type *EltTy = IntegerType::get(EltBits / 2);
>>> + return VectorType::get(EltTy, VTy->getNumElements());
>>> + }
>>
>> Should this assert that EltBits is a multiple of 2? It would be nice
>> for tblgen to reject cases where the size was not a multiple of two
>> also.
>
> I've added the assertion.
>
> TableGen can't check the vector element sizes since it never sees the
> specific types. It only sees the overloaded "iAny" types. Instead, I
> added a check in the verifier to make sure that vector elements with
> an odd bit-width don't get "truncated". Let me know if that doesn't
> address your concern.
Thanks! Seems reasonable to me,
-Chris
More information about the llvm-commits
mailing list