llvm.org GIT mirror llvm / 7d719a5
Do not convert between fp128 <-> ppc_fp128 since there is no legal cast conversion between the two. Patch by nobled <nobled@dreamwidth.org> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154772 91177308-0d34-0410-b5e6-96231b3b80d8 Nadav Rotem 8 years ago
1 changed file(s) with 12 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
411411 Value *Val0 = getRandomVectorValue();
412412 Value *V = ExtractElementInst::Create(Val0,
413413 ConstantInt::get(Type::getInt32Ty(BB->getContext()),
414 Ran->Rand() % cast(Val0->getType())->getNumElements()),
414 Ran->Rand() % cast(Val0->getType())->getNumElements()),
415415 "E", BB->getTerminator());
416416 return PT->push_back(V);
417417 }
475475 DestTy = pickVectorType(VecTy->getNumElements());
476476 }
477477
478 // no need to casr.
478 // no need to cast.
479479 if (VTy == DestTy) return;
480480
481481 // Pointers:
486486 new BitCastInst(V, DestTy, "PC", BB->getTerminator()));
487487 }
488488
489 unsigned VSize = VTy->getScalarType()->getPrimitiveSizeInBits();
490 unsigned DestSize = DestTy->getScalarType()->getPrimitiveSizeInBits();
491
489492 // Generate lots of bitcasts.
490 if ((Ran->Rand() & 1) &&
491 VTy->getPrimitiveSizeInBits() == DestTy->getPrimitiveSizeInBits()) {
493 if ((Ran->Rand() & 1) && VSize == DestSize) {
492494 return PT->push_back(
493495 new BitCastInst(V, DestTy, "BC", BB->getTerminator()));
494496 }
496498 // Both types are integers:
497499 if (VTy->getScalarType()->isIntegerTy() &&
498500 DestTy->getScalarType()->isIntegerTy()) {
499 if (VTy->getScalarType()->getPrimitiveSizeInBits() >
500 DestTy->getScalarType()->getPrimitiveSizeInBits()) {
501 if (VSize > DestSize) {
501502 return PT->push_back(
502503 new TruncInst(V, DestTy, "Tr", BB->getTerminator()));
503504 } else {
505 assert(VSize < DestSize && "Different int types with the same size?");
504506 if (Ran->Rand() & 1)
505507 return PT->push_back(
506508 new ZExtInst(V, DestTy, "ZE", BB->getTerminator()));
530532 // Both floats.
531533 if (VTy->getScalarType()->isFloatingPointTy() &&
532534 DestTy->getScalarType()->isFloatingPointTy()) {
533 if (VTy->getScalarType()->getPrimitiveSizeInBits() >
534 DestTy->getScalarType()->getPrimitiveSizeInBits()) {
535 if (VSize > DestSize) {
535536 return PT->push_back(
536537 new FPTruncInst(V, DestTy, "Tr", BB->getTerminator()));
537 } else {
538 } else if (VSize < DestSize) {
538539 return PT->push_back(
539540 new FPExtInst(V, DestTy, "ZE", BB->getTerminator()));
540541 }
542 // If VSize == DestSize, then the two types must be fp128 and ppc_fp128,
543 // for which there is no defined conversion. So do nothing.
541544 }
542545 }
543546