Lines Matching defs:CastInst

199 TEST(InstructionsTest, CastInst) {
240 EXPECT_EQ(CastInst::Trunc, CastInst::getCastOpcode(c64, true, V8x8Ty, true));
241 EXPECT_EQ(CastInst::SExt, CastInst::getCastOpcode(c8, true, V8x64Ty, true));
243 EXPECT_FALSE(CastInst::isBitCastable(V8x64Ty, V8x8Ty));
244 EXPECT_FALSE(CastInst::isBitCastable(V8x8Ty, V8x64Ty));
247 EXPECT_FALSE(CastInst::isBitCastable(PtrTy, PtrAS1Ty));
248 EXPECT_FALSE(CastInst::isBitCastable(PtrAS1Ty, PtrTy));
249 EXPECT_FALSE(CastInst::isBitCastable(V2PtrTy, V2PtrAS1Ty));
250 EXPECT_FALSE(CastInst::isBitCastable(V2PtrAS1Ty, V2PtrTy));
251 EXPECT_TRUE(CastInst::isBitCastable(V2PtrAS1Ty, V2PtrAS1Ty));
252 EXPECT_EQ(CastInst::AddrSpaceCast,
253 CastInst::getCastOpcode(v2ptr32, true, V2PtrAS1Ty, true));
256 EXPECT_FALSE(CastInst::isBitCastable(V2PtrAS1Ty, V4PtrAS1Ty));
257 EXPECT_FALSE(CastInst::isBitCastable(V4PtrAS1Ty, V2PtrAS1Ty));
258 EXPECT_FALSE(CastInst::isBitCastable(PtrTy, V2PtrTy));
259 EXPECT_FALSE(CastInst::isBitCastable(V2PtrTy, PtrTy));
261 EXPECT_TRUE(CastInst::isBitCastable(PtrTy, PtrTy));
262 EXPECT_FALSE(CastInst::isBitCastable(DoubleTy, FloatTy));
263 EXPECT_FALSE(CastInst::isBitCastable(FloatTy, DoubleTy));
264 EXPECT_TRUE(CastInst::isBitCastable(FloatTy, FloatTy));
265 EXPECT_TRUE(CastInst::isBitCastable(FloatTy, FloatTy));
266 EXPECT_TRUE(CastInst::isBitCastable(FloatTy, Int32Ty));
267 EXPECT_TRUE(CastInst::isBitCastable(Int16Ty, HalfTy));
268 EXPECT_TRUE(CastInst::isBitCastable(Int32Ty, FloatTy));
269 EXPECT_TRUE(CastInst::isBitCastable(V2Int32Ty, Int64Ty));
271 EXPECT_TRUE(CastInst::isBitCastable(V2Int32Ty, V4Int16Ty));
272 EXPECT_FALSE(CastInst::isBitCastable(Int32Ty, Int64Ty));
273 EXPECT_FALSE(CastInst::isBitCastable(Int64Ty, Int32Ty));
275 EXPECT_FALSE(CastInst::isBitCastable(V2PtrTy, Int64Ty));
276 EXPECT_FALSE(CastInst::isBitCastable(Int64Ty, V2PtrTy));
277 EXPECT_FALSE(CastInst::isBitCastable(V2Int32Ty, V2Int64Ty));
278 EXPECT_FALSE(CastInst::isBitCastable(V2Int64Ty, V2Int32Ty));
280 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
282 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
285 EXPECT_FALSE(CastInst::castIsValid(
287 EXPECT_FALSE(CastInst::castIsValid(
292 EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
295 EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
300 EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
303 EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
306 EXPECT_TRUE(CastInst::castIsValid(Instruction::AddrSpaceCast,
310 EXPECT_TRUE(CastInst::castIsValid(Instruction::AddrSpaceCast,
314 EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
319 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
322 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
325 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
328 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
331 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
334 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
339 EXPECT_TRUE(CastInst::castIsValid(Instruction::BitCast,
342 EXPECT_TRUE(CastInst::castIsValid(Instruction::BitCast,
345 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
348 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
353 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
356 EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
365 auto Inst1 = CastInst::CreatePointerCast(NullV2I32Ptr, V2Int32Ty, "foo", BB);
368 auto Inst1VScale = CastInst::CreatePointerCast(
372 auto Inst2 = CastInst::CreatePointerCast(NullV2I32Ptr, V2Int32Ty);
374 CastInst::CreatePointerCast(NullVScaleV2I32Ptr, VScaleV2Int32Ty);
458 CastInst *PtrVecA = new IntToPtrInst(C2xi32a, V2xPTy);
459 CastInst *PtrVecB = new IntToPtrInst(C2xi32b, V2xPTy);
475 CastInst *BTC0 = new BitCastInst(Gep0, V2xPTy);
476 CastInst *BTC1 = new BitCastInst(Gep1, V2xPTy);
477 CastInst *BTC2 = new BitCastInst(Gep2, V2xPTy);
478 CastInst *BTC3 = new BitCastInst(Gep3, V2xPTy);
617 EXPECT_EQ(CastInst::isEliminableCastPair(CastInst::PtrToInt,
618 CastInst::IntToPtr,
621 CastInst::BitCast);
625 EXPECT_EQ(CastInst::isEliminableCastPair(CastInst::PtrToInt,
626 CastInst::IntToPtr,
629 CastInst::BitCast);
633 EXPECT_EQ(CastInst::isEliminableCastPair(CastInst::PtrToInt,
634 CastInst::IntToPtr,
640 EXPECT_EQ(CastInst::isEliminableCastPair(CastInst::IntToPtr,
641 CastInst::PtrToInt,
644 CastInst::BitCast);
647 EXPECT_EQ(CastInst::isEliminableCastPair(CastInst::IntToPtr,
648 CastInst::PtrToInt,
666 EXPECT_EQ(CastInst::isEliminableCastPair(CastInst::IntToPtr,
667 CastInst::AddrSpaceCast,
673 EXPECT_EQ(CastInst::isEliminableCastPair(CastInst::AddrSpaceCast,
674 CastInst::PtrToInt,
680 EXPECT_EQ(CastInst::isEliminableCastPair(CastInst::IntToPtr,
681 CastInst::BitCast,
684 CastInst::IntToPtr);