diff --git a/llvm/include/llvm/IR/IntrinsicsAArch64.td b/llvm/include/llvm/IR/IntrinsicsAArch64.td --- a/llvm/include/llvm/IR/IntrinsicsAArch64.td +++ b/llvm/include/llvm/IR/IntrinsicsAArch64.td @@ -1044,6 +1044,12 @@ ], [IntrReadMem, IntrArgMemOnly]>; +class AdvSIMD_1VectorArg_Imm_Intrinsic + : Intrinsic<[llvm_anyvector_ty], + [LLVMMatchType<0>, + llvm_anyint_ty], + [IntrNoMem]>; + // // Integer arithmetic // @@ -1052,6 +1058,14 @@ def int_aarch64_sve_sub : AdvSIMD_Pred2VectorArg_Intrinsic; def int_aarch64_sve_subr : AdvSIMD_Pred2VectorArg_Intrinsic; +def int_aarch64_sve_add_imm : AdvSIMD_1VectorArg_Imm_Intrinsic; +def int_aarch64_sve_sub_imm : AdvSIMD_1VectorArg_Imm_Intrinsic; +def int_aarch64_sve_subr_imm : AdvSIMD_1VectorArg_Imm_Intrinsic; +def int_aarch64_sve_sqadd_imm : AdvSIMD_1VectorArg_Imm_Intrinsic; +def int_aarch64_sve_uqadd_imm : AdvSIMD_1VectorArg_Imm_Intrinsic; +def int_aarch64_sve_sqsub_imm : AdvSIMD_1VectorArg_Imm_Intrinsic; +def int_aarch64_sve_uqsub_imm : AdvSIMD_1VectorArg_Imm_Intrinsic; + def int_aarch64_sve_mul : AdvSIMD_Pred2VectorArg_Intrinsic; def int_aarch64_sve_smulh : AdvSIMD_Pred2VectorArg_Intrinsic; def int_aarch64_sve_umulh : AdvSIMD_Pred2VectorArg_Intrinsic; diff --git a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp --- a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp @@ -158,6 +158,11 @@ return false; } + template + bool SelectSVEAddSubImm(SDValue N, SDValue &Imm, SDValue &Shift) { + return SelectSVEAddSubImm(N, VT, Imm, Shift); + } + /// Form sequences of consecutive 64/128-bit registers for use in NEON /// instructions making use of a vector-list (e.g. ldN, tbl). Vecs must have /// between 1 and 4 elements. If it contains a single element that is returned @@ -234,6 +239,7 @@ bool SelectCMP_SWAP(SDNode *N); + bool SelectSVEAddSubImm(SDValue N, MVT VT, SDValue &Imm, SDValue &Shift); }; } // end anonymous namespace @@ -2810,6 +2816,54 @@ return true; } +bool AArch64DAGToDAGISel::SelectSVEAddSubImm(SDValue N, MVT VT, SDValue &Imm, SDValue &Shift) { + if (auto CNode = dyn_cast(N)) { + const int64_t ImmVal = CNode->getSExtValue(); + SDLoc DL(N); + + switch (VT.SimpleTy) { + case MVT::i8: + // Can always select i8s, no shift, mask the immediate value to + // deal with sign-extended value from lowering. + Shift = CurDAG->getTargetConstant(0, DL, MVT::i32); + Imm = CurDAG->getTargetConstant(ImmVal & 0xFF, DL, MVT::i32); + return true; + case MVT::i16: + // i16 values get sign-extended during lowering, so need to check for + // "negative" values when shifting. + if ((ImmVal & 0xFF) == ImmVal) { + Shift = CurDAG->getTargetConstant(0, DL, MVT::i32); + Imm = CurDAG->getTargetConstant(ImmVal, DL, MVT::i32); + return true; + } else if (((ImmVal & 0xFF) == 0) && + (ImmVal >= -32768) && + (ImmVal <= 32512)) { + Shift = CurDAG->getTargetConstant(8, DL, MVT::i32); + Imm = CurDAG->getTargetConstant((ImmVal/256) & 0xFF, DL, MVT::i32); + return true; + } + break; + case MVT::i32: + case MVT::i64: + // Range of immediate won't trigger signedness problems for 32/64b. + if ((ImmVal & 0xFF) == ImmVal) { + Shift = CurDAG->getTargetConstant(0, DL, MVT::i32); + Imm = CurDAG->getTargetConstant(ImmVal, DL, MVT::i32); + return true; + } else if ((ImmVal & 0xFF00) == ImmVal) { + Shift = CurDAG->getTargetConstant(8, DL, MVT::i32); + Imm = CurDAG->getTargetConstant(ImmVal >> 8, DL, MVT::i32); + return true; + } + default: + break; + } + } + + return false; +} + + bool AArch64DAGToDAGISel::trySelectStackSlotTagP(SDNode *N) { // tagp(FrameIndex, IRGstack, tag_offset): // since the offset between FrameIndex and IRGstack is a compile-time diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td --- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -75,13 +75,13 @@ defm AND_ZPmZ : sve_int_bin_pred_log<0b010, "and", int_aarch64_sve_and>; defm BIC_ZPmZ : sve_int_bin_pred_log<0b011, "bic", int_aarch64_sve_bic>; - defm ADD_ZI : sve_int_arith_imm0<0b000, "add">; - defm SUB_ZI : sve_int_arith_imm0<0b001, "sub">; - defm SUBR_ZI : sve_int_arith_imm0<0b011, "subr">; - defm SQADD_ZI : sve_int_arith_imm0<0b100, "sqadd">; - defm UQADD_ZI : sve_int_arith_imm0<0b101, "uqadd">; - defm SQSUB_ZI : sve_int_arith_imm0<0b110, "sqsub">; - defm UQSUB_ZI : sve_int_arith_imm0<0b111, "uqsub">; + defm ADD_ZI : sve_int_arith_imm0<0b000, "add", int_aarch64_sve_add_imm>; + defm SUB_ZI : sve_int_arith_imm0<0b001, "sub", int_aarch64_sve_sub_imm>; + defm SUBR_ZI : sve_int_arith_imm0<0b011, "subr", int_aarch64_sve_subr_imm>; + defm SQADD_ZI : sve_int_arith_imm0<0b100, "sqadd", int_aarch64_sve_sqadd_imm>; + defm UQADD_ZI : sve_int_arith_imm0<0b101, "uqadd", int_aarch64_sve_uqadd_imm>; + defm SQSUB_ZI : sve_int_arith_imm0<0b110, "sqsub", int_aarch64_sve_sqsub_imm>; + defm UQSUB_ZI : sve_int_arith_imm0<0b111, "uqsub", int_aarch64_sve_uqsub_imm>; defm MAD_ZPmZZ : sve_int_mladdsub_vvv_pred<0b0, "mad", int_aarch64_sve_mad>; defm MSB_ZPmZZ : sve_int_mladdsub_vvv_pred<0b1, "msb", int_aarch64_sve_msb>; diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td --- a/llvm/lib/Target/AArch64/SVEInstrFormats.td +++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td @@ -202,6 +202,11 @@ return AArch64_AM::isSVEAddSubImm(Imm); }]>; +def SVEAddSubImm8Pat : ComplexPattern", []>; +def SVEAddSubImm16Pat : ComplexPattern", []>; +def SVEAddSubImm32Pat : ComplexPattern", []>; +def SVEAddSubImm64Pat : ComplexPattern", []>; + class SVEExactFPImm : AsmOperandClass { let Name = "SVEExactFPImmOperand" # Suffix; let DiagnosticType = "Invalid" # Name; @@ -288,6 +293,11 @@ : Pat<(vtd (op vt1:$Op1)), (inst $Op1)>; +class SVE_1Op_Imm_OptLsl_Pat + : Pat<(vt (op (vt zprty:$Op1), (i32 (cpx i32:$imm, i32:$shift)))), + (inst $Op1, i32:$imm, i32:$shift)>; + class SVE_2_Op_Pat : Pat<(vtd (op vt1:$Op1, vt2:$Op2)), @@ -3268,11 +3278,16 @@ let ElementSize = ElementSizeNone; } -multiclass sve_int_arith_imm0 opc, string asm> { - def _B : sve_int_arith_imm0<0b00, opc, asm, ZPR8, addsub_imm8_opt_lsl_i8>; +multiclass sve_int_arith_imm0 opc, string asm, SDPatternOperator op> { + def _B : sve_int_arith_imm0<0b00, opc, asm, ZPR8, addsub_imm8_opt_lsl_i8>; def _H : sve_int_arith_imm0<0b01, opc, asm, ZPR16, addsub_imm8_opt_lsl_i16>; def _S : sve_int_arith_imm0<0b10, opc, asm, ZPR32, addsub_imm8_opt_lsl_i32>; def _D : sve_int_arith_imm0<0b11, opc, asm, ZPR64, addsub_imm8_opt_lsl_i64>; + + def : SVE_1Op_Imm_OptLsl_Pat(NAME # _B)>; + def : SVE_1Op_Imm_OptLsl_Pat(NAME # _H)>; + def : SVE_1Op_Imm_OptLsl_Pat(NAME # _S)>; + def : SVE_1Op_Imm_OptLsl_Pat(NAME # _D)>; } class sve_int_arith_imm sz8_64, bits<6> opc, string asm, diff --git a/llvm/test/CodeGen/AArch64/sve-int-imm.ll b/llvm/test/CodeGen/AArch64/sve-int-imm.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve-int-imm.ll @@ -0,0 +1,471 @@ +; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s + +define @add_imm_i8_low( %a) { +; CHECK-LABEL: add_imm_i8_low +; CHECK: add z0.b, z0.b, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.add.imm.nxv16i8( %a, + i32 30) + ret %res +} + +define @add_imm_i16_low( %a) { +; CHECK-LABEL: add_imm_i16_low +; CHECK: add z0.h, z0.h, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.add.imm.nxv8i16( %a, + i32 30) + ret %res +} + +define @add_imm_i16_high( %a) { +; CHECK-LABEL: add_imm_i16_high +; CHECK: add z0.h, z0.h, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.add.imm.nxv8i16( %a, + i32 1024) + ret %res +} + +define @add_imm_i32_low( %a) { +; CHECK-LABEL: add_imm_i32_low +; CHECK: add z0.s, z0.s, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.add.imm.nxv4i32( %a, + i32 30) + ret %res +} + +define @add_imm_i32_high( %a) { +; CHECK-LABEL: add_imm_i32_high +; CHECK: add z0.s, z0.s, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.add.imm.nxv4i32( %a, + i32 1024) + ret %res +} + +define @add_imm_i64_low( %a) { +; CHECK-LABEL: add_imm_i64_low +; CHECK: add z0.d, z0.d, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.add.imm.nxv2i64( %a, + i32 30) + ret %res +} + +define @add_imm_i64_high( %a) { +; CHECK-LABEL: add_imm_i64_high +; CHECK: add z0.d, z0.d, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.add.imm.nxv2i64( %a, + i32 1024) + ret %res +} + +define @sub_imm_i8_low( %a) { +; CHECK-LABEL: sub_imm_i8_low +; CHECK: sub z0.b, z0.b, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sub.imm.nxv16i8( %a, + i32 30) + ret %res +} + +define @sub_imm_i16_low( %a) { +; CHECK-LABEL: sub_imm_i16_low +; CHECK: sub z0.h, z0.h, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sub.imm.nxv8i16( %a, + i32 30) + ret %res +} + +define @sub_imm_i16_high( %a) { +; CHECK-LABEL: sub_imm_i16_high +; CHECK: sub z0.h, z0.h, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sub.imm.nxv8i16( %a, + i32 1024) + ret %res +} + +define @sub_imm_i32_low( %a) { +; CHECK-LABEL: sub_imm_i32_low +; CHECK: sub z0.s, z0.s, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sub.imm.nxv4i32( %a, + i32 30) + ret %res +} + +define @sub_imm_i32_high( %a) { +; CHECK-LABEL: sub_imm_i32_high +; CHECK: sub z0.s, z0.s, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sub.imm.nxv4i32( %a, + i32 1024) + ret %res +} + +define @sub_imm_i64_low( %a) { +; CHECK-LABEL: sub_imm_i64_low +; CHECK: sub z0.d, z0.d, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sub.imm.nxv2i64( %a, + i32 30) + ret %res +} + +define @sub_imm_i64_high( %a) { +; CHECK-LABEL: sub_imm_i64_high +; CHECK: sub z0.d, z0.d, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sub.imm.nxv2i64( %a, + i32 1024) + ret %res +} + +define @subr_imm_i8_low( %a) { +; CHECK-LABEL: subr_imm_i8_low +; CHECK: subr z0.b, z0.b, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.subr.imm.nxv16i8( %a, + i32 30) + ret %res +} + +define @subr_imm_i16_low( %a) { +; CHECK-LABEL: subr_imm_i16_low +; CHECK: subr z0.h, z0.h, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.subr.imm.nxv8i16( %a, + i32 30) + ret %res +} + +define @subr_imm_i16_high( %a) { +; CHECK-LABEL: subr_imm_i16_high +; CHECK: subr z0.h, z0.h, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.subr.imm.nxv8i16( %a, + i32 1024) + ret %res +} + +define @subr_imm_i32_low( %a) { +; CHECK-LABEL: subr_imm_i32_low +; CHECK: subr z0.s, z0.s, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.subr.imm.nxv4i32( %a, + i32 30) + ret %res +} + +define @subr_imm_i32_high( %a) { +; CHECK-LABEL: subr_imm_i32_high +; CHECK: subr z0.s, z0.s, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.subr.imm.nxv4i32( %a, + i32 1024) + ret %res +} + +define @subr_imm_i64_low( %a) { +; CHECK-LABEL: subr_imm_i64_low +; CHECK: subr z0.d, z0.d, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.subr.imm.nxv2i64( %a, + i32 30) + ret %res +} + +define @subr_imm_i64_high( %a) { +; CHECK-LABEL: subr_imm_i64_high +; CHECK: subr z0.d, z0.d, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.subr.imm.nxv2i64( %a, + i32 1024) + ret %res +} + +define @sqadd_imm_i8_low( %a) { +; CHECK-LABEL: sqadd_imm_i8_low +; CHECK: sqadd z0.b, z0.b, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqadd.imm.nxv16i8( %a, + i32 30) + ret %res +} + +define @sqadd_imm_i16_low( %a) { +; CHECK-LABEL: sqadd_imm_i16_low +; CHECK: sqadd z0.h, z0.h, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqadd.imm.nxv8i16( %a, + i32 30) + ret %res +} + +define @sqadd_imm_i16_high( %a) { +; CHECK-LABEL: sqadd_imm_i16_high +; CHECK: sqadd z0.h, z0.h, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqadd.imm.nxv8i16( %a, + i32 1024) + ret %res +} + +define @sqadd_imm_i32_low( %a) { +; CHECK-LABEL: sqadd_imm_i32_low +; CHECK: sqadd z0.s, z0.s, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqadd.imm.nxv4i32( %a, + i32 30) + ret %res +} + +define @sqadd_imm_i32_high( %a) { +; CHECK-LABEL: sqadd_imm_i32_high +; CHECK: sqadd z0.s, z0.s, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqadd.imm.nxv4i32( %a, + i32 1024) + ret %res +} + +define @sqadd_imm_i64_low( %a) { +; CHECK-LABEL: sqadd_imm_i64_low +; CHECK: sqadd z0.d, z0.d, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqadd.imm.nxv2i64( %a, + i32 30) + ret %res +} + +define @sqadd_imm_i64_high( %a) { +; CHECK-LABEL: sqadd_imm_i64_high +; CHECK: sqadd z0.d, z0.d, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqadd.imm.nxv2i64( %a, + i32 1024) + ret %res +} + +define @uqadd_imm_i8_low( %a) { +; CHECK-LABEL: uqadd_imm_i8_low +; CHECK: uqadd z0.b, z0.b, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqadd.imm.nxv16i8( %a, + i32 30) + ret %res +} + +define @uqadd_imm_i16_low( %a) { +; CHECK-LABEL: uqadd_imm_i16_low +; CHECK: uqadd z0.h, z0.h, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqadd.imm.nxv8i16( %a, + i32 30) + ret %res +} + +define @uqadd_imm_i16_high( %a) { +; CHECK-LABEL: uqadd_imm_i16_high +; CHECK: uqadd z0.h, z0.h, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqadd.imm.nxv8i16( %a, + i32 1024) + ret %res +} + +define @uqadd_imm_i32_low( %a) { +; CHECK-LABEL: uqadd_imm_i32_low +; CHECK: uqadd z0.s, z0.s, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqadd.imm.nxv4i32( %a, + i32 30) + ret %res +} + +define @uqadd_imm_i32_high( %a) { +; CHECK-LABEL: uqadd_imm_i32_high +; CHECK: uqadd z0.s, z0.s, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqadd.imm.nxv4i32( %a, + i32 1024) + ret %res +} + +define @uqadd_imm_i64_low( %a) { +; CHECK-LABEL: uqadd_imm_i64_low +; CHECK: uqadd z0.d, z0.d, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqadd.imm.nxv2i64( %a, + i32 30) + ret %res +} + +define @uqadd_imm_i64_high( %a) { +; CHECK-LABEL: uqadd_imm_i64_high +; CHECK: uqadd z0.d, z0.d, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqadd.imm.nxv2i64( %a, + i32 1024) + ret %res +} + +define @sqsub_imm_i8_low( %a) { +; CHECK-LABEL: sqsub_imm_i8_low +; CHECK: sqsub z0.b, z0.b, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqsub.imm.nxv16i8( %a, + i32 30) + ret %res +} + +define @sqsub_imm_i16_low( %a) { +; CHECK-LABEL: sqsub_imm_i16_low +; CHECK: sqsub z0.h, z0.h, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqsub.imm.nxv8i16( %a, + i32 30) + ret %res +} + +define @sqsub_imm_i16_high( %a) { +; CHECK-LABEL: sqsub_imm_i16_high +; CHECK: sqsub z0.h, z0.h, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqsub.imm.nxv8i16( %a, + i32 1024) + ret %res +} + +define @sqsub_imm_i32_low( %a) { +; CHECK-LABEL: sqsub_imm_i32_low +; CHECK: sqsub z0.s, z0.s, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqsub.imm.nxv4i32( %a, + i32 30) + ret %res +} + +define @sqsub_imm_i32_high( %a) { +; CHECK-LABEL: sqsub_imm_i32_high +; CHECK: sqsub z0.s, z0.s, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqsub.imm.nxv4i32( %a, + i32 1024) + ret %res +} + +define @sqsub_imm_i64_low( %a) { +; CHECK-LABEL: sqsub_imm_i64_low +; CHECK: sqsub z0.d, z0.d, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqsub.imm.nxv2i64( %a, + i32 30) + ret %res +} + +define @sqsub_imm_i64_high( %a) { +; CHECK-LABEL: sqsub_imm_i64_high +; CHECK: sqsub z0.d, z0.d, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.sqsub.imm.nxv2i64( %a, + i32 1024) + ret %res +} + +define @uqsub_imm_i8_low( %a) { +; CHECK-LABEL: uqsub_imm_i8_low +; CHECK: uqsub z0.b, z0.b, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqsub.imm.nxv16i8( %a, + i32 30) + ret %res +} + +define @uqsub_imm_i16_low( %a) { +; CHECK-LABEL: uqsub_imm_i16_low +; CHECK: uqsub z0.h, z0.h, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqsub.imm.nxv8i16( %a, + i32 30) + ret %res +} + +define @uqsub_imm_i16_high( %a) { +; CHECK-LABEL: uqsub_imm_i16_high +; CHECK: uqsub z0.h, z0.h, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqsub.imm.nxv8i16( %a, + i32 1024) + ret %res +} + +define @uqsub_imm_i32_low( %a) { +; CHECK-LABEL: uqsub_imm_i32_low +; CHECK: uqsub z0.s, z0.s, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqsub.imm.nxv4i32( %a, + i32 30) + ret %res +} + +define @uqsub_imm_i32_high( %a) { +; CHECK-LABEL: uqsub_imm_i32_high +; CHECK: uqsub z0.s, z0.s, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqsub.imm.nxv4i32( %a, + i32 1024) + ret %res +} + +define @uqsub_imm_i64_low( %a) { +; CHECK-LABEL: uqsub_imm_i64_low +; CHECK: uqsub z0.d, z0.d, #30 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqsub.imm.nxv2i64( %a, + i32 30) + ret %res +} + +define @uqsub_imm_i64_high( %a) { +; CHECK-LABEL: uqsub_imm_i64_high +; CHECK: uqsub z0.d, z0.d, #1024 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uqsub.imm.nxv2i64( %a, + i32 1024) + ret %res +} + +declare @llvm.aarch64.sve.add.imm.nxv16i8(, i32) +declare @llvm.aarch64.sve.add.imm.nxv8i16(, i32) +declare @llvm.aarch64.sve.add.imm.nxv4i32(, i32) +declare @llvm.aarch64.sve.add.imm.nxv2i64(, i32) +declare @llvm.aarch64.sve.sub.imm.nxv16i8(, i32) +declare @llvm.aarch64.sve.sub.imm.nxv8i16(, i32) +declare @llvm.aarch64.sve.sub.imm.nxv4i32(, i32) +declare @llvm.aarch64.sve.sub.imm.nxv2i64(, i32) +declare @llvm.aarch64.sve.subr.imm.nxv16i8(, i32) +declare @llvm.aarch64.sve.subr.imm.nxv8i16(, i32) +declare @llvm.aarch64.sve.subr.imm.nxv4i32(, i32) +declare @llvm.aarch64.sve.subr.imm.nxv2i64(, i32) +declare @llvm.aarch64.sve.sqadd.imm.nxv16i8(, i32) +declare @llvm.aarch64.sve.sqadd.imm.nxv8i16(, i32) +declare @llvm.aarch64.sve.sqadd.imm.nxv4i32(, i32) +declare @llvm.aarch64.sve.sqadd.imm.nxv2i64(, i32) +declare @llvm.aarch64.sve.uqadd.imm.nxv16i8(, i32) +declare @llvm.aarch64.sve.uqadd.imm.nxv8i16(, i32) +declare @llvm.aarch64.sve.uqadd.imm.nxv4i32(, i32) +declare @llvm.aarch64.sve.uqadd.imm.nxv2i64(, i32) +declare @llvm.aarch64.sve.sqsub.imm.nxv16i8(, i32) +declare @llvm.aarch64.sve.sqsub.imm.nxv8i16(, i32) +declare @llvm.aarch64.sve.sqsub.imm.nxv4i32(, i32) +declare @llvm.aarch64.sve.sqsub.imm.nxv2i64(, i32) +declare @llvm.aarch64.sve.uqsub.imm.nxv16i8(, i32) +declare @llvm.aarch64.sve.uqsub.imm.nxv8i16(, i32) +declare @llvm.aarch64.sve.uqsub.imm.nxv4i32(, i32) +declare @llvm.aarch64.sve.uqsub.imm.nxv2i64(, i32)