Skip to content

Commit 77d7f96

Browse files
committed
fix: review
1 parent 6948943 commit 77d7f96

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
@@ -13089,7 +13089,7 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
1308913089
bool IsFAllOne = ISD::isBuildVectorAllOnes(FVal.getNode());
1309013090

1309113091
// no vselect(cond, 0/-1, X) or vselect(cond, X, 0/-1), return
13092-
if (!(IsTAllZero || IsTAllOne || IsFAllZero || IsFAllOne))
13092+
if (!IsTAllZero && !IsTAllOne && !IsFAllZero && !IsFAllOne)
1309313093
return SDValue();
1309413094

1309513095
// select Cond, 0, 0 → 0
@@ -13106,6 +13106,10 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
1310613106
if (CondVT.getScalarSizeInBits() != VT.getScalarSizeInBits())
1310713107
return SDValue();
1310813108

13109+
// Cond value must be 'sign splat' to be converted to a logical op.
13110+
if (DAG.ComputeNumSignBits(Cond) != CondVT.getScalarSizeInBits())
13111+
return SDValue();
13112+
1310913113
// Try inverting Cond and swapping T/F if it gives all-ones/all-zeros form
1311013114
if (!IsTAllOne && !IsFAllZero && Cond.hasOneUse() &&
1311113115
Cond.getOpcode() == ISD::SETCC &&
@@ -13123,10 +13127,6 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
1312313127
}
1312413128
}
1312513129

13126-
// Cond value must be 'sign splat' to be converted to a logical op.
13127-
if (DAG.ComputeNumSignBits(Cond) != CondVT.getScalarSizeInBits())
13128-
return SDValue();
13129-
1313013130
// select Cond, -1, 0 → bitcast Cond
1313113131
if (IsTAllOne && IsFAllZero)
1313213132
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)