[llvm] 042a656 - [PowerPC] Guard XSRSP in P8 for FastISel
Jinsong Ji via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 7 08:17:59 PDT 2021
Author: Jinsong Ji
Date: 2021-09-07T15:17:51Z
New Revision: 042a6564d3656b5268fe9e2e2dad8e9726467710
URL: https://github.com/llvm/llvm-project/commit/042a6564d3656b5268fe9e2e2dad8e9726467710
DIFF: https://github.com/llvm/llvm-project/commit/042a6564d3656b5268fe9e2e2dad8e9726467710.diff
LOG: [PowerPC] Guard XSRSP in P8 for FastISel
This is exposed by enabling FastIsel on 64bit AIX.
We are generating XSRSP regardless of the arch,
which may be wrong when -mcpu=pwr7.
The fix is to guard the generation in P8 only.
Reviewed By: qiucf
Differential Revision: https://reviews.llvm.org/D109365
Added:
Modified:
llvm/lib/Target/PowerPC/PPCFastISel.cpp
llvm/test/CodeGen/PowerPC/fast-isel-rsp.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/PowerPC/PPCFastISel.cpp b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
index 9148a8cb15544..856569bc8a73b 100644
--- a/llvm/lib/Target/PowerPC/PPCFastISel.cpp
+++ b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
@@ -987,15 +987,16 @@ bool PPCFastISel::SelectFPTrunc(const Instruction *I) {
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
index 700e159ac830b..2e55aa30bf110 100644
--- 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:
More information about the llvm-commits
mailing list