[llvm-commits] PATCH: remove VICmp and VFCmp.

Eli Friedman eli.friedman at gmail.com
Fri Jul 10 07:06:27 PDT 2009


On Fri, Jul 10, 2009 at 2:33 AM, Duncan Sands<baldrick at free.fr> wrote:
> Hi Eli,
>
>>>> So what's the alternative?  Bitcast to i8 and then store?
>>> I don't think bitcasting to i8 will be possible: lots of places
>>> "know" that bitcast is the same as "store as first type, load
>>> as the other".  If <8 x i1> doesn't store like i8 then allowing
>>> bitcast would break this invariant.  I don't think that's wise.
>>
>> Mmm, right... that's nasty.  But we also can't just make bitcasting
>> to/from vector types illegal; a lot of existing code depends on that.
>
> I'm not suggesting making bitcast illegal.  I'm saying that bitcast
> between a vector and some other type should be legal exactly when
> TargetData's getTypeSizeInBits is the same for both.  Thus it would
> be legal to bitcast a <8 x i1> to an i64, since they would both be
> 64 bits long.  Likewise <4 x i32> to <2 x i64> would be ok.  However
> you would no longer be able to bitcast <8 x i1> to i8.

So your proposal is roughly equivalent to the following patch?  Seems
like a reasonable proposal; I wasn't quite following it originally.
Any ideas for the wording in LangRef?

Index: llvm/DerivedTypes.h
===================================================================
--- llvm/DerivedTypes.h	(revision 75201)
+++ llvm/DerivedTypes.h	(working copy)
@@ -431,7 +431,8 @@

   /// @brief Return the number of bits in the Vector type.
   inline unsigned getBitWidth() const {
-    return NumElements *getElementType()->getPrimitiveSizeInBits();
+    return NumElements *
+           ((getElementType()->getPrimitiveSizeInBits() + 7) & -8);
   }

   // Implement the AbstractTypeUser interface.

-Eli




More information about the llvm-commits mailing list