mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Implement casts.ll:test26: a cast from float -> double -> integer, doesn't
need the float->double part. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25452 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3799,7 +3799,7 @@ static CastType getCastType(const Type *Src, const Type *Dest) {
|
|||||||
// isEliminableCastOfCast - Return true if it is valid to eliminate the CI
|
// isEliminableCastOfCast - Return true if it is valid to eliminate the CI
|
||||||
// instruction.
|
// instruction.
|
||||||
//
|
//
|
||||||
static inline bool isEliminableCastOfCast(const Type *SrcTy, const Type *MidTy,
|
static bool isEliminableCastOfCast(const Type *SrcTy, const Type *MidTy,
|
||||||
const Type *DstTy, TargetData *TD) {
|
const Type *DstTy, TargetData *TD) {
|
||||||
|
|
||||||
// It is legal to eliminate the instruction if casting A->B->A if the sizes
|
// It is legal to eliminate the instruction if casting A->B->A if the sizes
|
||||||
@@ -3856,6 +3856,15 @@ static inline bool isEliminableCastOfCast(const Type *SrcTy, const Type *MidTy,
|
|||||||
return ResultCast == FirstCast;
|
return ResultCast == FirstCast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this is a cast from 'float -> double -> integer', cast from
|
||||||
|
// 'float -> integer' directly, as the value isn't changed by the
|
||||||
|
// float->double conversion.
|
||||||
|
if (SrcTy->isFloatingPoint() && MidTy->isFloatingPoint() &&
|
||||||
|
DstTy->isIntegral() &&
|
||||||
|
SrcTy->getPrimitiveSize() < MidTy->getPrimitiveSize())
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user