Index: lib/Target/PowerPC/PPCCTRLoops.cpp =================================================================== --- lib/Target/PowerPC/PPCCTRLoops.cpp +++ lib/Target/PowerPC/PPCCTRLoops.cpp @@ -422,6 +422,23 @@ if (SI->getNumCases() + 1 >= (unsigned)TLI->getMinimumJumpTableEntries()) return true; } + if (TM->getSubtargetImpl(*BB->getParent())->getTargetLowering()->useSoftFloat()) { + switch(J->getOpcode()) { + case Instruction::FAdd: + case Instruction::FSub: + case Instruction::FMul: + case Instruction::FDiv: + case Instruction::FRem: + case Instruction::FPTrunc: + case Instruction::FPExt: + case Instruction::FPToUI: + case Instruction::FPToSI: + case Instruction::UIToFP: + case Instruction::SIToFP: + case Instruction::FCmp: + return true; + } + } for (Value *Operand : J->operands()) if (memAddrUsesCTR(TM, Operand)) return true; Index: test/CodeGen/PowerPC/ctrloops-softfloat.ll =================================================================== --- test/CodeGen/PowerPC/ctrloops-softfloat.ll +++ test/CodeGen/PowerPC/ctrloops-softfloat.ll @@ -0,0 +1,141 @@ +; RUN: llc -mtriple=powerpc-unknown-linux-gnu -O0 < %s | FileCheck %s + +; ModuleID = 'CTRLoops.c' +; double x, y; +; +; void foo1() +; { +; x = y = 1.1; +; for (int i = 0; i < 175; i++) +; y = x + y; +; } +; void foo2() +; { +; x = y = 1.1; +; for (int i = 0; i < 175; i++) +; y = x - y; +; } +; void foo3() +; { +; x = y = 1.1; +; for (int i = 0; i < 175; i++) +; y = x * y; +; } +; void foo4() +; { +; x = y = 1.1; +; for (int i = 0; i < 175; i++) +; y = x / y; +; } + +target datalayout = "E-m:e-p:32:32-i64:64-n32" +target triple = "powerpc-buildroot-linux-gnu" + +@y = common global double 0.000000e+00, align 8 +@x = common global double 0.000000e+00, align 8 + +; Function Attrs: norecurse nounwind +define void @foo1() #0 { + store double 1.100000e+00, double* @y, align 8, !tbaa !1 + store double 1.100000e+00, double* @x, align 8, !tbaa !1 + br label %2 + +;