Skip to content

Commit c154703

Browse files
committed
comments
1 parent a3ee9d6 commit c154703

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28922,6 +28922,7 @@ static SDValue matchMergedBFX(SDValue Root, SelectionDAG &DAG,
2892228922

2892328923
EVT VT = Root.getValueType();
2892428924

28925+
// TODO: Support vectors?
2892528926
if (!VT.isScalarInteger() || Root.getOpcode() != ISD::AND)
2892628927
return SDValue();
2892728928

@@ -28997,8 +28998,8 @@ SDValue DAGCombiner::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
2899728998
TLI.SimplifySetCC(VT, N0, N1, Cond, foldBooleans, DagCombineInfo, DL))
2899828999
return C;
2899929000

29000-
if ((Cond == ISD::SETNE || Cond == ISD::SETEQ) &&
29001-
N0.getOpcode() == ISD::AND && isNullConstant(N1)) {
29001+
if (ISD::isIntEqualitySetCC(Cond) && N0.getOpcode() == ISD::AND &&
29002+
isNullConstant(N1)) {
2900229003

2900329004
if (SDValue Res = matchMergedBFX(N0, DAG, TLI))
2900429005
return DAG.getSetCC(DL, VT, Res, N1, Cond);

llvm/test/CodeGen/AMDGPU/merged-bfx-opt.ll

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,24 @@ entry:
100100
%cmp = icmp ne i32 %or1, 0
101101
ret i1 %cmp
102102
}
103+
104+
define i1 @eq_i32_3x5_all_shifted(i32 %arg) {
105+
; CHECK-LABEL: eq_i32_3x5_all_shifted:
106+
; CHECK: ; %bb.0: ; %entry
107+
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
108+
; CHECK-NEXT: v_and_b32_e32 v0, 0x7ffc, v0
109+
; CHECK-NEXT: v_cmp_ne_u32_e32 vcc, 0, v0
110+
; CHECK-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
111+
; CHECK-NEXT: s_setpc_b64 s[30:31]
112+
entry:
113+
%sh2 = lshr i32 %arg, 2
114+
%a = and i32 %sh2, 31
115+
%sh5 = lshr i32 %arg, 7
116+
%b = and i32 %sh5, 31
117+
%or = or i32 %a, %b
118+
%sh10 = lshr i32 %arg, 10
119+
%c = and i32 %sh10, 31
120+
%or1 = or i32 %or, %c
121+
%cmp = icmp ne i32 %or1, 0
122+
ret i1 %cmp
123+
}

0 commit comments

Comments
 (0)