[llvm] r350799 - Recommit "[PowerPC] Fix assert from machine verify pass that unmatched register class about fcmp selection in fast-isel"
Zi Xuan Wu via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 9 22:20:15 PST 2019
Author: wuzish
Date: Wed Jan 9 22:20:14 2019
New Revision: 350799
URL: http://llvm.org/viewvc/llvm-project?rev=350799&view=rev
Log:
Recommit "[PowerPC] Fix assert from machine verify pass that unmatched register class about fcmp selection in fast-isel"
This re-commit r350685.
Differential Revision: https://reviews.llvm.org/D55686
Modified:
llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp
llvm/trunk/test/CodeGen/PowerPC/fast-isel-fcmp-nan.ll
llvm/trunk/test/CodeGen/PowerPC/vsx-self-copy.ll
Modified: llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp?rev=350799&r1=350798&r2=350799&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp Wed Jan 9 22:20:14 2019
@@ -861,8 +861,20 @@ bool PPCFastISel::PPCEmitCmp(const Value
}
}
+ unsigned SrcReg1 = getRegForValue(SrcValue1);
+ if (SrcReg1 == 0)
+ return false;
+
+ unsigned SrcReg2 = 0;
+ if (!UseImm) {
+ SrcReg2 = getRegForValue(SrcValue2);
+ if (SrcReg2 == 0)
+ return false;
+ }
+
unsigned CmpOpc;
bool NeedsExt = false;
+ auto RC = MRI.getRegClass(SrcReg1);
switch (SrcVT.SimpleTy) {
default: return false;
case MVT::f32:
@@ -879,8 +891,15 @@ bool PPCFastISel::PPCEmitCmp(const Value
CmpOpc = PPC::EFSCMPGT;
break;
}
- } else
+ } else {
CmpOpc = PPC::FCMPUS;
+ if (isVSSRCRegClass(RC)) {
+ unsigned TmpReg = createResultReg(&PPC::F4RCRegClass);
+ BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
+ TII.get(TargetOpcode::COPY), TmpReg).addReg(SrcReg1);
+ SrcReg1 = TmpReg;
+ }
+ }
break;
case MVT::f64:
if (HasSPE) {
@@ -896,8 +915,11 @@ bool PPCFastISel::PPCEmitCmp(const Value
CmpOpc = PPC::EFDCMPGT;
break;
}
- } else
+ } else if (isVSFRCRegClass(RC)) {
+ CmpOpc = PPC::XSCMPUDP;
+ } else {
CmpOpc = PPC::FCMPUD;
+ }
break;
case MVT::i1:
case MVT::i8:
@@ -918,17 +940,6 @@ bool PPCFastISel::PPCEmitCmp(const Value
break;
}
- unsigned SrcReg1 = getRegForValue(SrcValue1);
- if (SrcReg1 == 0)
- return false;
-
- unsigned SrcReg2 = 0;
- if (!UseImm) {
- SrcReg2 = getRegForValue(SrcValue2);
- if (SrcReg2 == 0)
- return false;
- }
-
if (NeedsExt) {
unsigned ExtReg = createResultReg(&PPC::GPRCRegClass);
if (!PPCEmitIntExt(SrcVT, SrcReg1, MVT::i32, ExtReg, IsZExt))
Modified: llvm/trunk/test/CodeGen/PowerPC/fast-isel-fcmp-nan.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/fast-isel-fcmp-nan.ll?rev=350799&r1=350798&r2=350799&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/fast-isel-fcmp-nan.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/fast-isel-fcmp-nan.ll Wed Jan 9 22:20:14 2019
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple powerpc64le-unknown-linux-gnu -fast-isel -O0 < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple powerpc64le-unknown-linux-gnu -fast-isel -O0 < %s | FileCheck %s
define i1 @TestULT(double %t0) {
; CHECK-LABEL: TestULT:
@@ -17,7 +17,7 @@ good:
define i1 @TestULE(double %t0) {
; CHECK-LABEL: TestULE:
-; CHECK: fcmpu
+; CHECK: xscmpudp
; CHECK-NEXT: ble
; CHECK: blr
entry:
@@ -33,7 +33,7 @@ good:
define i1 @TestUNE(double %t0) {
; CHECK-LABEL: TestUNE:
-; CHECK: fcmpu
+; CHECK: xscmpudp
; CHECK-NEXT: bne
; CHECK: blr
entry:
@@ -79,7 +79,7 @@ good:
define i1 @TestUGE(double %t0) {
; CHECK-LABEL: TestUGE:
-; CHECK: fcmpu
+; CHECK: xscmpudp
; CHECK-NEXT: bge
; CHECK: blr
entry:
@@ -95,7 +95,7 @@ good:
define i1 @TestOLT(double %t0) {
; CHECK-LABEL: TestOLT:
-; CHECK: fcmpu
+; CHECK: xscmpudp
; CHECK-NEXT: blt
; CHECK: blr
entry:
@@ -141,7 +141,7 @@ good:
define i1 @TestOEQ(double %t0) {
; CHECK-LABEL: TestOEQ:
-; CHECK: fcmpu
+; CHECK: xscmpudp
; CHECK-NEXT: beq
; CHECK: blr
entry:
@@ -157,7 +157,7 @@ good:
define i1 @TestOGT(double %t0) {
; CHECK-LABEL: TestOGT:
-; CHECK: fcmpu
+; CHECK: xscmpudp
; CHECK-NEXT: bgt
; CHECK: blr
entry:
Modified: llvm/trunk/test/CodeGen/PowerPC/vsx-self-copy.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/vsx-self-copy.ll?rev=350799&r1=350798&r2=350799&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/vsx-self-copy.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/vsx-self-copy.ll Wed Jan 9 22:20:14 2019
@@ -1,5 +1,5 @@
-; RUN: llc -mcpu=pwr7 -mattr=+vsx < %s | FileCheck %s
-; RUN: llc -mcpu=pwr7 -mattr=+vsx -fast-isel -O0 < %s | FileCheck %s
+; RUN: llc -mcpu=pwr7 -mattr=+vsx < %s -verify-machineinstrs | FileCheck %s
+; RUN: llc -mcpu=pwr7 -mattr=+vsx -fast-isel -O0 < %s -verify-machineinstrs | FileCheck %s
target datalayout = "E-m:e-i64:64-n32:64"
target triple = "powerpc64-unknown-linux-gnu"
More information about the llvm-commits
mailing list