Skip to content

Commit 6569249

Browse files
author
himadhith
committed
Changed the patch to work only with Integer vector types
1 parent 86f6cee commit 6569249

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4576,10 +4576,17 @@ bool PPCDAGToDAGISel::trySETCC(SDNode *N) {
45764576
// * for k != 0, change SETNE to SETUGT (k > 0)
45774577
// * for 0 != k, change SETNE to SETULT (0 < k)
45784578
if (CC == ISD::SETNE) {
4579+
EVT VT = LHS.getValueType();
4580+
4581+
// Only optimize for integer types (avoid FP completely)
4582+
bool IsIntegerType =
4583+
VT.isInteger() ||
4584+
(VT.isVector() && VT.getVectorElementType().isInteger());
4585+
if(IsIntegerType){
45794586
if (ISD::isBuildVectorAllZeros(RHS.getNode()))
45804587
CC = ISD::SETUGT;
45814588
else if (ISD::isBuildVectorAllZeros(LHS.getNode()))
4582-
CC = ISD::SETULT;
4589+
CC = ISD::SETULT;}
45834590
}
45844591
EVT VecVT = LHS.getValueType();
45854592
bool Swap, Negate;

llvm/test/CodeGen/PowerPC/recipest.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ define <4 x float> @hoo3_fmf(<4 x float> %a) #1 {
10341034
; CHECK-P7-NEXT: vmaddfp v5, v5, v0, v3
10351035
; CHECK-P7-NEXT: vmaddfp v3, v5, v4, v3
10361036
; CHECK-P7-NEXT: vxor v4, v4, v4
1037-
; CHECK-P7-NEXT: vcmpgefp v2, v4, v2
1037+
; CHECK-P7-NEXT: vcmpeqfp v2, v2, v4
10381038
; CHECK-P7-NEXT: vnot v2, v2
10391039
; CHECK-P7-NEXT: vand v2, v2, v3
10401040
; CHECK-P7-NEXT: blr

0 commit comments

Comments
 (0)