diff --git a/llvm/lib/Target/PowerPC/PPCFastISel.cpp b/llvm/lib/Target/PowerPC/PPCFastISel.cpp --- a/llvm/lib/Target/PowerPC/PPCFastISel.cpp +++ b/llvm/lib/Target/PowerPC/PPCFastISel.cpp @@ -987,15 +987,16 @@ auto RC = MRI.getRegClass(SrcReg); if (Subtarget->hasSPE()) { DestReg = createResultReg(&PPC::GPRCRegClass); - BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, - TII.get(PPC::EFSCFD), DestReg) - .addReg(SrcReg); - } else if (isVSFRCRegClass(RC)) { + BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(PPC::EFSCFD), + DestReg) + .addReg(SrcReg); + } else if (Subtarget->hasP8Vector() && isVSFRCRegClass(RC)) { DestReg = createResultReg(&PPC::VSSRCRegClass); - BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, - TII.get(PPC::XSRSP), DestReg) - .addReg(SrcReg); + BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(PPC::XSRSP), + DestReg) + .addReg(SrcReg); } else { + SrcReg = copyRegToRegClass(&PPC::F8RCRegClass, SrcReg); DestReg = createResultReg(&PPC::F4RCRegClass); BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(PPC::FRSP), DestReg) diff --git a/llvm/test/CodeGen/PowerPC/fast-isel-rsp.ll b/llvm/test/CodeGen/PowerPC/fast-isel-rsp.ll --- a/llvm/test/CodeGen/PowerPC/fast-isel-rsp.ll +++ b/llvm/test/CodeGen/PowerPC/fast-isel-rsp.ll @@ -2,6 +2,10 @@ ; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=GENERIC ; RUN: llc -mcpu=ppc -mtriple=powerpc64le-unknown-unknown -O0 < %s \ ; RUN: -verify-machineinstrs | FileCheck %s +; RUN: llc -mcpu=pwr7 -mtriple=powerpc64-ibm-aix-xcoff -O0 < %s \ +; RUN: -verify-machineinstrs | FileCheck %s + + define float @testRSP(double %x) { entry: