From 7ebdc37d2bbfc62ff7957b346bb3a91eb6044d5f Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 31 Mar 2011 21:35:49 +0000 Subject: [PATCH] InstCombine: APFloat can't perform arithmetic on PPC double doubles, don't even try. Thanks Eli! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128676 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/InstCombine/InstCombineCompares.cpp | 6 ++++-- test/Transforms/InstCombine/fcmp.ll | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp index 3e549d94282..8afd2f8d004 100644 --- a/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2769,6 +2769,10 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { if (!RHSF) break; + // We can't convert a PPC double double. + if (RHSF->getType()->isPPC_FP128Ty()) + break; + const fltSemantics *Sem; // FIXME: This shouldn't be here. if (LHSExt->getSrcTy()->isFloatTy()) @@ -2779,8 +2783,6 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { Sem = &APFloat::IEEEquad; else if (LHSExt->getSrcTy()->isX86_FP80Ty()) Sem = &APFloat::x87DoubleExtended; - else if (LHSExt->getSrcTy()->isPPC_FP128Ty()) - Sem = &APFloat::PPCDoubleDouble; else break; diff --git a/test/Transforms/InstCombine/fcmp.ll b/test/Transforms/InstCombine/fcmp.ll index b41cdfa7cf1..2eb4f058692 100644 --- a/test/Transforms/InstCombine/fcmp.ll +++ b/test/Transforms/InstCombine/fcmp.ll @@ -49,3 +49,12 @@ define i1 @test6(float %x, float %y) nounwind { ; CHECK: @test6 ; CHECK-NEXT: fcmp ogt float %x, %y } + +define i1 @test7(float %x) nounwind readnone ssp noredzone { + %ext = fpext float %x to ppc_fp128 + %cmp = fcmp ogt ppc_fp128 %ext, 0xM00000000000000000000000000000000 + ret i1 %cmp +; Can't convert ppc_fp128 +; CHECK: @test7 +; CHECK-NEXT: fpext float %x to ppc_fp128 +} -- 2.34.1