mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
Enable some additional constant folding for PPCDoubleDouble.
This fixes Clang :: CodeGen/complex-builtints.c on PowerPC. llvm-svn: 167013
This commit is contained in:
parent
40eb1b4055
commit
2df331332d
@ -2897,10 +2897,6 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
|
|||||||
if (!RHSF)
|
if (!RHSF)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// We can't convert a PPC double double.
|
|
||||||
if (RHSF->getType()->isPPC_FP128Ty())
|
|
||||||
break;
|
|
||||||
|
|
||||||
const fltSemantics *Sem;
|
const fltSemantics *Sem;
|
||||||
// FIXME: This shouldn't be here.
|
// FIXME: This shouldn't be here.
|
||||||
if (LHSExt->getSrcTy()->isHalfTy())
|
if (LHSExt->getSrcTy()->isHalfTy())
|
||||||
@ -2913,6 +2909,8 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
|
|||||||
Sem = &APFloat::IEEEquad;
|
Sem = &APFloat::IEEEquad;
|
||||||
else if (LHSExt->getSrcTy()->isX86_FP80Ty())
|
else if (LHSExt->getSrcTy()->isX86_FP80Ty())
|
||||||
Sem = &APFloat::x87DoubleExtended;
|
Sem = &APFloat::x87DoubleExtended;
|
||||||
|
else if (LHSExt->getSrcTy()->isPPC_FP128Ty())
|
||||||
|
Sem = &APFloat::PPCDoubleDouble;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -514,10 +514,6 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
|
|||||||
return UndefValue::get(DestTy);
|
return UndefValue::get(DestTy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No compile-time operations on this type yet.
|
|
||||||
if (V->getType()->isPPC_FP128Ty() || DestTy->isPPC_FP128Ty())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (V->isNullValue() && !DestTy->isX86_MMXTy())
|
if (V->isNullValue() && !DestTy->isX86_MMXTy())
|
||||||
return Constant::getNullValue(DestTy);
|
return Constant::getNullValue(DestTy);
|
||||||
|
|
||||||
@ -576,6 +572,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
|
|||||||
DestTy->isDoubleTy() ? APFloat::IEEEdouble :
|
DestTy->isDoubleTy() ? APFloat::IEEEdouble :
|
||||||
DestTy->isX86_FP80Ty() ? APFloat::x87DoubleExtended :
|
DestTy->isX86_FP80Ty() ? APFloat::x87DoubleExtended :
|
||||||
DestTy->isFP128Ty() ? APFloat::IEEEquad :
|
DestTy->isFP128Ty() ? APFloat::IEEEquad :
|
||||||
|
DestTy->isPPC_FP128Ty() ? APFloat::PPCDoubleDouble :
|
||||||
APFloat::Bogus,
|
APFloat::Bogus,
|
||||||
APFloat::rmNearestTiesToEven, &ignored);
|
APFloat::rmNearestTiesToEven, &ignored);
|
||||||
return ConstantFP::get(V->getContext(), Val);
|
return ConstantFP::get(V->getContext(), Val);
|
||||||
@ -646,7 +643,8 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
|
|||||||
case Instruction::SIToFP:
|
case Instruction::SIToFP:
|
||||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
|
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
|
||||||
APInt api = CI->getValue();
|
APInt api = CI->getValue();
|
||||||
APFloat apf(APInt::getNullValue(DestTy->getPrimitiveSizeInBits()), true);
|
APFloat apf(APInt::getNullValue(DestTy->getPrimitiveSizeInBits()),
|
||||||
|
!DestTy->isPPC_FP128Ty() /* isEEEE */);
|
||||||
(void)apf.convertFromAPInt(api,
|
(void)apf.convertFromAPInt(api,
|
||||||
opc==Instruction::SIToFP,
|
opc==Instruction::SIToFP,
|
||||||
APFloat::rmNearestTiesToEven);
|
APFloat::rmNearestTiesToEven);
|
||||||
@ -867,10 +865,6 @@ Constant *llvm::ConstantFoldInsertValueInstruction(Constant *Agg,
|
|||||||
|
|
||||||
Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
|
Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
|
||||||
Constant *C1, Constant *C2) {
|
Constant *C1, Constant *C2) {
|
||||||
// No compile-time operations on this type yet.
|
|
||||||
if (C1->getType()->isPPC_FP128Ty())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Handle UndefValue up front.
|
// Handle UndefValue up front.
|
||||||
if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) {
|
if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) {
|
||||||
switch (Opcode) {
|
switch (Opcode) {
|
||||||
@ -1273,10 +1267,6 @@ static FCmpInst::Predicate evaluateFCmpRelation(Constant *V1, Constant *V2) {
|
|||||||
assert(V1->getType() == V2->getType() &&
|
assert(V1->getType() == V2->getType() &&
|
||||||
"Cannot compare values of different types!");
|
"Cannot compare values of different types!");
|
||||||
|
|
||||||
// No compile-time operations on this type yet.
|
|
||||||
if (V1->getType()->isPPC_FP128Ty())
|
|
||||||
return FCmpInst::BAD_FCMP_PREDICATE;
|
|
||||||
|
|
||||||
// Handle degenerate case quickly
|
// Handle degenerate case quickly
|
||||||
if (V1 == V2) return FCmpInst::FCMP_OEQ;
|
if (V1 == V2) return FCmpInst::FCMP_OEQ;
|
||||||
|
|
||||||
@ -1602,10 +1592,6 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
|
|||||||
return ConstantInt::get(ResultTy, CmpInst::isTrueWhenEqual(pred));
|
return ConstantInt::get(ResultTy, CmpInst::isTrueWhenEqual(pred));
|
||||||
}
|
}
|
||||||
|
|
||||||
// No compile-time operations on this type yet.
|
|
||||||
if (C1->getType()->isPPC_FP128Ty())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// icmp eq/ne(null,GV) -> false/true
|
// icmp eq/ne(null,GV) -> false/true
|
||||||
if (C1->isNullValue()) {
|
if (C1->isNullValue()) {
|
||||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(C2))
|
if (const GlobalValue *GV = dyn_cast<GlobalValue>(C2))
|
||||||
|
@ -54,9 +54,8 @@ define i1 @test7(float %x) nounwind readnone ssp noredzone {
|
|||||||
%ext = fpext float %x to ppc_fp128
|
%ext = fpext float %x to ppc_fp128
|
||||||
%cmp = fcmp ogt ppc_fp128 %ext, 0xM00000000000000000000000000000000
|
%cmp = fcmp ogt ppc_fp128 %ext, 0xM00000000000000000000000000000000
|
||||||
ret i1 %cmp
|
ret i1 %cmp
|
||||||
; Can't convert ppc_fp128
|
|
||||||
; CHECK: @test7
|
; CHECK: @test7
|
||||||
; CHECK-NEXT: fpext float %x to ppc_fp128
|
; CHECK-NEXT: fcmp ogt float %x, 0.000000e+00
|
||||||
}
|
}
|
||||||
|
|
||||||
define float @test8(float %x) nounwind readnone optsize ssp {
|
define float @test8(float %x) nounwind readnone optsize ssp {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user