+ EXPECT_FALSE(CastInst::isBitCastable(V8x8Ty, X86MMXTy));
+ EXPECT_FALSE(CastInst::isBitCastable(X86MMXTy, V8x8Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(Int64Ty, X86MMXTy));
+ EXPECT_FALSE(CastInst::isBitCastable(V8x64Ty, V8x8Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(V8x8Ty, V8x64Ty));
+
+ // Check address space casts are rejected since we don't know the sizes here
+ EXPECT_FALSE(CastInst::isBitCastable(Int32PtrTy, Int32PtrAS1Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(Int32PtrAS1Ty, Int32PtrTy));
+ EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrTy, V2Int32PtrAS1Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V2Int32PtrTy));
+ EXPECT_TRUE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V2Int64PtrAS1Ty));
+
+ // Test mismatched number of elements for pointers
+ EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V4Int64PtrAS1Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(V4Int64PtrAS1Ty, V2Int32PtrAS1Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V4Int32PtrAS1Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(Int32PtrTy, V2Int32PtrTy));
+ EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrTy, Int32PtrTy));
+
+ EXPECT_TRUE(CastInst::isBitCastable(Int32PtrTy, Int64PtrTy));
+ EXPECT_FALSE(CastInst::isBitCastable(DoubleTy, FloatTy));
+ EXPECT_FALSE(CastInst::isBitCastable(FloatTy, DoubleTy));
+ EXPECT_TRUE(CastInst::isBitCastable(FloatTy, FloatTy));
+ EXPECT_TRUE(CastInst::isBitCastable(FloatTy, FloatTy));
+ EXPECT_TRUE(CastInst::isBitCastable(FloatTy, Int32Ty));
+ EXPECT_TRUE(CastInst::isBitCastable(Int16Ty, HalfTy));
+ EXPECT_TRUE(CastInst::isBitCastable(Int32Ty, FloatTy));
+ EXPECT_TRUE(CastInst::isBitCastable(V2Int32Ty, Int64Ty));
+
+ EXPECT_TRUE(CastInst::isBitCastable(V2Int32Ty, V4Int16Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(Int32Ty, Int64Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(Int64Ty, Int32Ty));
+
+ EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrTy, Int64Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(Int64Ty, V2Int32PtrTy));
+ EXPECT_TRUE(CastInst::isBitCastable(V2Int64PtrTy, V2Int32PtrTy));
+ EXPECT_TRUE(CastInst::isBitCastable(V2Int32PtrTy, V2Int64PtrTy));
+ EXPECT_FALSE(CastInst::isBitCastable(V2Int32Ty, V2Int64Ty));
+ EXPECT_FALSE(CastInst::isBitCastable(V2Int64Ty, V2Int32Ty));
+}