mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Revert "Revert r222040 because of bot failure."
This reverts commit r222203, reverting r222040 didn't end up turning the bot green. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222261 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1269,14 +1269,17 @@ Instruction *InstCombiner::visitFPTrunc(FPTruncInst &CI) {
|
||||
// type of OpI doesn't enter into things at all. We simply evaluate
|
||||
// in whichever source type is larger, then convert to the
|
||||
// destination type.
|
||||
Value *NewLHS = LHSOrig, *NewRHS = RHSOrig;
|
||||
if (LHSWidth < SrcWidth)
|
||||
LHSOrig = Builder->CreateFPExt(LHSOrig, RHSOrig->getType());
|
||||
NewLHS = Builder->CreateFPExt(NewLHS, RHSOrig->getType());
|
||||
else if (RHSWidth <= SrcWidth)
|
||||
RHSOrig = Builder->CreateFPExt(RHSOrig, LHSOrig->getType());
|
||||
Value *ExactResult = Builder->CreateFRem(LHSOrig, RHSOrig);
|
||||
if (Instruction *RI = dyn_cast<Instruction>(ExactResult))
|
||||
RI->copyFastMathFlags(OpI);
|
||||
return CastInst::CreateFPCast(ExactResult, CI.getType());
|
||||
NewRHS = Builder->CreateFPExt(NewRHS, LHSOrig->getType());
|
||||
if (NewLHS != LHSOrig || NewRHS != RHSOrig) {
|
||||
Value *ExactResult = Builder->CreateFRem(NewLHS, NewRHS);
|
||||
if (Instruction *RI = dyn_cast<Instruction>(ExactResult))
|
||||
RI->copyFastMathFlags(OpI);
|
||||
return CastInst::CreateFPCast(ExactResult, CI.getType());
|
||||
}
|
||||
}
|
||||
|
||||
// (fptrunc (fneg x)) -> (fneg (fptrunc x))
|
||||
|
Reference in New Issue
Block a user