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
This commit is contained in:
Nadav Rotem 2012-04-15 20:17:14 +00:00
parent 00920f68a4
commit 7d719a5237

View File

@ -476,7 +476,7 @@ struct CastModifier: public Modifier {
DestTy = pickVectorType(VecTy->getNumElements());
}
// no need to casr.
// no need to cast.
if (VTy == DestTy) return;
// Pointers:
@ -487,9 +487,11 @@ struct CastModifier: public Modifier {
new BitCastInst(V, DestTy, "PC", BB->getTerminator()));
}
unsigned VSize = VTy->getScalarType()->getPrimitiveSizeInBits();
unsigned DestSize = DestTy->getScalarType()->getPrimitiveSizeInBits();
// Generate lots of bitcasts.
if ((Ran->Rand() & 1) &&
VTy->getPrimitiveSizeInBits() == DestTy->getPrimitiveSizeInBits()) {
if ((Ran->Rand() & 1) && VSize == DestSize) {
return PT->push_back(
new BitCastInst(V, DestTy, "BC", BB->getTerminator()));
}
@ -497,11 +499,11 @@ struct CastModifier: public Modifier {
// Both types are integers:
if (VTy->getScalarType()->isIntegerTy() &&
DestTy->getScalarType()->isIntegerTy()) {
if (VTy->getScalarType()->getPrimitiveSizeInBits() >
DestTy->getScalarType()->getPrimitiveSizeInBits()) {
if (VSize > DestSize) {
return PT->push_back(
new TruncInst(V, DestTy, "Tr", BB->getTerminator()));
} else {
assert(VSize < DestSize && "Different int types with the same size?");
if (Ran->Rand() & 1)
return PT->push_back(
new ZExtInst(V, DestTy, "ZE", BB->getTerminator()));
@ -531,14 +533,15 @@ struct CastModifier: public Modifier {
// Both floats.
if (VTy->getScalarType()->isFloatingPointTy() &&
DestTy->getScalarType()->isFloatingPointTy()) {
if (VTy->getScalarType()->getPrimitiveSizeInBits() >
DestTy->getScalarType()->getPrimitiveSizeInBits()) {
if (VSize > DestSize) {
return PT->push_back(
new FPTruncInst(V, DestTy, "Tr", BB->getTerminator()));
} else {
} else if (VSize < DestSize) {
return PT->push_back(
new FPExtInst(V, DestTy, "ZE", BB->getTerminator()));
}
// If VSize == DestSize, then the two types must be fp128 and ppc_fp128,
// for which there is no defined conversion. So do nothing.
}
}