diff --git a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp index 17e530a4641df..58048869fa2ec 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp @@ -3152,7 +3152,6 @@ bool AArch64DAGToDAGISel::SelectSVEAddSubImm(SDValue N, MVT VT, SDValue &Imm, SD Imm = CurDAG->getTargetConstant(ImmVal, DL, MVT::i32); return true; } else if ((ImmVal & 0xFF) == 0) { - assert((ImmVal >= -32768) && (ImmVal <= 32512)); Shift = CurDAG->getTargetConstant(8, DL, MVT::i32); Imm = CurDAG->getTargetConstant((ImmVal >> 8) & 0xFF, DL, MVT::i32); return true; diff --git a/llvm/test/CodeGen/AArch64/sve-int-arith-imm.ll b/llvm/test/CodeGen/AArch64/sve-int-arith-imm.ll index 3b1c332bdd806..540dcc609995e 100644 --- a/llvm/test/CodeGen/AArch64/sve-int-arith-imm.ll +++ b/llvm/test/CodeGen/AArch64/sve-int-arith-imm.ll @@ -800,4 +800,18 @@ entry: ret %div } +; +; UQSUB +; +define @uqsub( %a) { +; CHECK-LABEL: uqsub: +; CHECK: // %bb.0: +; CHECK-NEXT: uqsub z0.h, z0.h, #32768 // =0x8000 +; CHECK-NEXT: ret + %cmp = icmp slt %a, shufflevector ( insertelement ( undef, i16 0, i32 0), undef, zeroinitializer) + %sub = xor %a, shufflevector ( insertelement ( undef, i16 -32768, i32 0), undef, zeroinitializer) + %sel = select %cmp, %sub, shufflevector ( insertelement ( undef, i16 0, i32 0), undef, zeroinitializer) + ret %sel +} + attributes #0 = { minsize }