Skip to content

Commit 1ae947f

Browse files
committed
Addresses PR reviews
1 parent 45ad537 commit 1ae947f

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3409,30 +3409,18 @@ combineVectorSizedSetCCEquality(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
34093409
if (!IsVectorBitCastCheap(X) || !IsVectorBitCastCheap(Y))
34103410
return SDValue();
34113411

3412-
// TODO: Not sure what's the purpose of this? I'm keeping here since RISCV has
3413-
// it
3414-
if (DCI.DAG.getMachineFunction().getFunction().hasFnAttribute(
3415-
Attribute::NoImplicitFloat))
3416-
return SDValue();
3417-
3418-
unsigned OpSize = OpVT.getSizeInBits();
3419-
unsigned VecSize = OpSize / 8;
3420-
3421-
EVT VecVT = EVT::getVectorVT(*DCI.DAG.getContext(), MVT::i8, VecSize);
3422-
EVT CmpVT = EVT::getVectorVT(*DCI.DAG.getContext(), MVT::i8, VecSize);
3412+
EVT VecVT = MVT::v16i8;
34233413

34243414
SDValue VecX = DAG.getBitcast(VecVT, X);
34253415
SDValue VecY = DAG.getBitcast(VecVT, Y);
34263416

3427-
SDValue Cmp = DAG.getSetCC(DL, CmpVT, VecX, VecY, CC);
3417+
SDValue Cmp = DAG.getSetCC(DL, VecVT, VecX, VecY, CC);
34283418

3429-
SDValue AllTrue = DAG.getZExtOrTrunc(
3430-
DAG.getNode(
3431-
ISD::INTRINSIC_WO_CHAIN, DL, MVT::i32,
3432-
{DAG.getConstant(Intrinsic::wasm_alltrue, DL, MVT::i32), Cmp}),
3433-
DL, MVT::i1);
3419+
SDValue AllTrue = DAG.getNode(
3420+
ISD::INTRINSIC_WO_CHAIN, DL, MVT::i32,
3421+
{DAG.getConstant(Intrinsic::wasm_alltrue, DL, MVT::i32), Cmp});
34343422

3435-
return DAG.getSetCC(DL, VT, AllTrue, DAG.getConstant(0, DL, MVT::i1), CC);
3423+
return DAG.getSetCC(DL, VT, AllTrue, DAG.getConstant(0, DL, MVT::i32), CC);
34363424
}
34373425

34383426
static SDValue performSETCCCombine(SDNode *N,

llvm/test/CodeGen/WebAssembly/memcmp-expand.ll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ define i1 @memcmp_expand_16(ptr %a, ptr %b) {
136136
; CHECK-NEXT: v128.load $push0=, 0($1):p2align=0
137137
; CHECK-NEXT: i8x16.eq $push2=, $pop1, $pop0
138138
; CHECK-NEXT: i8x16.all_true $push3=, $pop2
139-
; CHECK-NEXT: i32.const $push4=, 1
140-
; CHECK-NEXT: i32.xor $push5=, $pop3, $pop4
141-
; CHECK-NEXT: return $pop5
139+
; CHECK-NEXT: i32.eqz $push4=, $pop3
140+
; CHECK-NEXT: return $pop4
142141
%cmp_16 = call i32 @memcmp(ptr %a, ptr %b, i32 16)
143142
%res = icmp eq i32 %cmp_16, 0
144143
ret i1 %res

0 commit comments

Comments
 (0)