diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 24e1ebd8421fbf..070163a5fb297c 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -18430,7 +18430,7 @@ static SDValue performUADDVAddCombine(SDValue A, SelectionDAG &DAG) { EVT VT = A.getValueType(); SDValue Op0 = A.getOperand(0); SDValue Op1 = A.getOperand(1); - if (Op0.getOpcode() != Op0.getOpcode() || + if (Op0.getOpcode() != Op1.getOpcode() || (Op0.getOpcode() != ISD::ZERO_EXTEND && Op0.getOpcode() != ISD::SIGN_EXTEND)) return SDValue(); diff --git a/llvm/test/CodeGen/AArch64/vecreduce-add.ll b/llvm/test/CodeGen/AArch64/vecreduce-add.ll index 8473f45f6c803b..5d6b523f1549ac 100644 --- a/llvm/test/CodeGen/AArch64/vecreduce-add.ll +++ b/llvm/test/CodeGen/AArch64/vecreduce-add.ll @@ -72,6 +72,24 @@ entry: ret i64 %z } +define i64 @add_v4i32_v4i64_zsext(<4 x i32> %xi) { +; CHECK-LABEL: add_v4i32_v4i64_zsext: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: ushll v1.2d, v0.2s, #0 +; CHECK-NEXT: saddw2 v0.2d, v1.2d, v0.4s +; CHECK-NEXT: addp d0, v0.2d +; CHECK-NEXT: fmov x0, d0 +; CHECK-NEXT: ret +entry: + %x = shufflevector <4 x i32> %xi, <4 x i32> %xi, <2 x i32> + %y = shufflevector <4 x i32> %xi, <4 x i32> %xi, <2 x i32> + %xx = zext <2 x i32> %x to <2 x i64> + %yy = sext <2 x i32> %y to <2 x i64> + %zz = add <2 x i64> %xx, %yy + %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %zz) + ret i64 %z +} + define i64 @add_v2i32_v2i64_zext(<2 x i32> %x) { ; CHECK-LABEL: add_v2i32_v2i64_zext: ; CHECK: // %bb.0: // %entry