Skip to content

Commit 9c9afee

Browse files
committed
fix: review
1 parent 45d1f82 commit 9c9afee

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13007,7 +13007,7 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
1300713007
bool IsFAllOne = ISD::isBuildVectorAllOnes(FVal.getNode());
1300813008

1300913009
// no vselect(cond, 0/-1, X) or vselect(cond, X, 0/-1), return
13010-
if (!(IsTAllZero || IsTAllOne || IsFAllZero || IsFAllOne))
13010+
if (!IsTAllZero && !IsTAllOne && !IsFAllZero && !IsFAllOne)
1301113011
return SDValue();
1301213012

1301313013
// select Cond, 0, 0 → 0
@@ -13024,6 +13024,10 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
1302413024
if (CondVT.getScalarSizeInBits() != VT.getScalarSizeInBits())
1302513025
return SDValue();
1302613026

13027+
// Cond value must be 'sign splat' to be converted to a logical op.
13028+
if (DAG.ComputeNumSignBits(Cond) != CondVT.getScalarSizeInBits())
13029+
return SDValue();
13030+
1302713031
// Try inverting Cond and swapping T/F if it gives all-ones/all-zeros form
1302813032
if (!IsTAllOne && !IsFAllZero && Cond.hasOneUse() &&
1302913033
Cond.getOpcode() == ISD::SETCC &&
@@ -13041,10 +13045,6 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
1304113045
}
1304213046
}
1304313047

13044-
// Cond value must be 'sign splat' to be converted to a logical op.
13045-
if (DAG.ComputeNumSignBits(Cond) != CondVT.getScalarSizeInBits())
13046-
return SDValue();
13047-
1304813048
// select Cond, -1, 0 → bitcast Cond
1304913049
if (IsTAllOne && IsFAllZero)
1305013050
return DAG.getBitcast(VT, Cond);

llvm/test/CodeGen/Mips/msa/compare_float.ll

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2-
; RUN: llc -mtriple=mips-elf -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s --check-prefixes=CHECK,MIPS
3-
; RUN: llc -mtriple=mipsel-elf -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s --check-prefixes=CHECK,MIPSEL
2+
; RUN: llc -mtriple=mips-elf -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s
43

54
declare <4 x float> @llvm.mips.fmax.w(<4 x float>, <4 x float>) nounwind
65
declare <2 x double> @llvm.mips.fmax.d(<2 x double>, <2 x double>) nounwind
@@ -618,6 +617,3 @@ define void @min_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
618617
store <2 x double> %3, ptr %c
619618
ret void
620619
}
621-
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
622-
; MIPS: {{.*}}
623-
; MIPSEL: {{.*}}

0 commit comments

Comments
 (0)