; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s 2>%t | FileCheck %s ; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t ; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it. ; WARN-NOT: warning ; ; SVE Arith Vector Immediate Unpredicated CodeGen ; ; ADD define @add_i8_low( %a) { ; CHECK-LABEL: add_i8_low ; CHECK: add z0.b, z0.b, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i8 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = add %a, %splat ret %res } define @add_i16_low( %a) { ; CHECK-LABEL: add_i16_low ; CHECK: add z0.h, z0.h, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i16 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = add %a, %splat ret %res } define @add_i16_high( %a) { ; CHECK-LABEL: add_i16_high ; CHECK: add z0.h, z0.h, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i16 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = add %a, %splat ret %res } define @add_i32_low( %a) { ; CHECK-LABEL: add_i32_low ; CHECK: add z0.s, z0.s, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i32 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = add %a, %splat ret %res } define @add_i32_high( %a) { ; CHECK-LABEL: add_i32_high ; CHECK: add z0.s, z0.s, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i32 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = add %a, %splat ret %res } define @add_i64_low( %a) { ; CHECK-LABEL: add_i64_low ; CHECK: add z0.d, z0.d, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i64 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = add %a, %splat ret %res } define @add_i64_high( %a) { ; CHECK-LABEL: add_i64_high ; CHECK: add z0.d, z0.d, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i64 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = add %a, %splat ret %res } ; SUBR define @subr_i8_low( %a) { ; CHECK-LABEL: subr_i8_low ; CHECK: subr z0.b, z0.b, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i8 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %splat, %a ret %res } define @subr_i16_low( %a) { ; CHECK-LABEL: subr_i16_low ; CHECK: subr z0.h, z0.h, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i16 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %splat, %a ret %res } define @subr_i16_high( %a) { ; CHECK-LABEL: subr_i16_high ; CHECK: subr z0.h, z0.h, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i16 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %splat, %a ret %res } define @subr_i32_low( %a) { ; CHECK-LABEL: subr_i32_low ; CHECK: subr z0.s, z0.s, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i32 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %splat, %a ret %res } define @subr_i32_high( %a) { ; CHECK-LABEL: subr_i32_high ; CHECK: subr z0.s, z0.s, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i32 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %splat, %a ret %res } define @subr_i64_low( %a) { ; CHECK-LABEL: subr_i64_low ; CHECK: subr z0.d, z0.d, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i64 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %splat, %a ret %res } define @subr_i64_high( %a) { ; CHECK-LABEL: subr_i64_high ; CHECK: subr z0.d, z0.d, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i64 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %splat, %a ret %res } ; SUB define @sub_i8_low( %a) { ; CHECK-LABEL: sub_i8_low ; CHECK: sub z0.b, z0.b, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i8 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %a, %splat ret %res } define @sub_i16_low( %a) { ; CHECK-LABEL: sub_i16_low ; CHECK: sub z0.h, z0.h, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i16 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %a, %splat ret %res } define @sub_i16_high( %a) { ; CHECK-LABEL: sub_i16_high ; CHECK: sub z0.h, z0.h, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i16 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %a, %splat ret %res } define @sub_i32_low( %a) { ; CHECK-LABEL: sub_i32_low ; CHECK: sub z0.s, z0.s, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i32 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %a, %splat ret %res } define @sub_i32_high( %a) { ; CHECK-LABEL: sub_i32_high ; CHECK: sub z0.s, z0.s, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i32 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %a, %splat ret %res } define @sub_i64_low( %a) { ; CHECK-LABEL: sub_i64_low ; CHECK: sub z0.d, z0.d, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i64 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %a, %splat ret %res } define @sub_i64_high( %a) { ; CHECK-LABEL: sub_i64_high ; CHECK: sub z0.d, z0.d, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i64 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = sub %a, %splat ret %res } ; SQADD define @sqadd_i8_low( %a) { ; CHECK-LABEL: sqadd_i8_low ; CHECK: sqadd z0.b, z0.b, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i8 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.sadd.sat.nxv16i8( %a, %splat) ret %res } define @sqadd_i16_low( %a) { ; CHECK-LABEL: sqadd_i16_low ; CHECK: sqadd z0.h, z0.h, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i16 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.sadd.sat.nxv8i16( %a, %splat) ret %res } define @sqadd_i16_high( %a) { ; CHECK-LABEL: sqadd_i16_high ; CHECK: sqadd z0.h, z0.h, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i16 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.sadd.sat.nxv8i16( %a, %splat) ret %res } define @sqadd_i32_low( %a) { ; CHECK-LABEL: sqadd_i32_low ; CHECK: sqadd z0.s, z0.s, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i32 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.sadd.sat.nxv4i32( %a, %splat) ret %res } define @sqadd_i32_high( %a) { ; CHECK-LABEL: sqadd_i32_high ; CHECK: sqadd z0.s, z0.s, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i32 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.sadd.sat.nxv4i32( %a, %splat) ret %res } define @sqadd_i64_low( %a) { ; CHECK-LABEL: sqadd_i64_low ; CHECK: sqadd z0.d, z0.d, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i64 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.sadd.sat.nxv2i64( %a, %splat) ret %res } define @sqadd_i64_high( %a) { ; CHECK-LABEL: sqadd_i64_high ; CHECK: sqadd z0.d, z0.d, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i64 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.sadd.sat.nxv2i64( %a, %splat) ret %res } ; UQADD define @uqadd_i8_low( %a) { ; CHECK-LABEL: uqadd_i8_low ; CHECK: uqadd z0.b, z0.b, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i8 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.uadd.sat.nxv16i8( %a, %splat) ret %res } define @uqadd_i16_low( %a) { ; CHECK-LABEL: uqadd_i16_low ; CHECK: uqadd z0.h, z0.h, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i16 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.uadd.sat.nxv8i16( %a, %splat) ret %res } define @uqadd_i16_high( %a) { ; CHECK-LABEL: uqadd_i16_high ; CHECK: uqadd z0.h, z0.h, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i16 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.uadd.sat.nxv8i16( %a, %splat) ret %res } define @uqadd_i32_low( %a) { ; CHECK-LABEL: uqadd_i32_low ; CHECK: uqadd z0.s, z0.s, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i32 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.uadd.sat.nxv4i32( %a, %splat) ret %res } define @uqadd_i32_high( %a) { ; CHECK-LABEL: uqadd_i32_high ; CHECK: uqadd z0.s, z0.s, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i32 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.uadd.sat.nxv4i32( %a, %splat) ret %res } define @uqadd_i64_low( %a) { ; CHECK-LABEL: uqadd_i64_low ; CHECK: uqadd z0.d, z0.d, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i64 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.uadd.sat.nxv2i64( %a, %splat) ret %res } define @uqadd_i64_high( %a) { ; CHECK-LABEL: uqadd_i64_high ; CHECK: uqadd z0.d, z0.d, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i64 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.uadd.sat.nxv2i64( %a, %splat) ret %res } ; SQSUB define @sqsub_i8_low( %a) { ; CHECK-LABEL: sqsub_i8_low ; CHECK: sqsub z0.b, z0.b, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i8 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.ssub.sat.nxv16i8( %a, %splat) ret %res } define @sqsub_i16_low( %a) { ; CHECK-LABEL: sqsub_i16_low ; CHECK: sqsub z0.h, z0.h, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i16 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.ssub.sat.nxv8i16( %a, %splat) ret %res } define @sqsub_i16_high( %a) { ; CHECK-LABEL: sqsub_i16_high ; CHECK: sqsub z0.h, z0.h, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i16 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.ssub.sat.nxv8i16( %a, %splat) ret %res } define @sqsub_i32_low( %a) { ; CHECK-LABEL: sqsub_i32_low ; CHECK: sqsub z0.s, z0.s, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i32 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.ssub.sat.nxv4i32( %a, %splat) ret %res } define @sqsub_i32_high( %a) { ; CHECK-LABEL: sqsub_i32_high ; CHECK: sqsub z0.s, z0.s, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i32 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.ssub.sat.nxv4i32( %a, %splat) ret %res } define @sqsub_i64_low( %a) { ; CHECK-LABEL: sqsub_i64_low ; CHECK: sqsub z0.d, z0.d, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i64 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.ssub.sat.nxv2i64( %a, %splat) ret %res } define @sqsub_i64_high( %a) { ; CHECK-LABEL: sqsub_i64_high ; CHECK: sqsub z0.d, z0.d, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i64 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.ssub.sat.nxv2i64( %a, %splat) ret %res } ; UQSUB define @uqsub_i8_low( %a) { ; CHECK-LABEL: uqsub_i8_low ; CHECK: uqsub z0.b, z0.b, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i8 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.usub.sat.nxv16i8( %a, %splat) ret %res } define @uqsub_i16_low( %a) { ; CHECK-LABEL: uqsub_i16_low ; CHECK: uqsub z0.h, z0.h, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i16 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.usub.sat.nxv8i16( %a, %splat) ret %res } define @uqsub_i16_high( %a) { ; CHECK-LABEL: uqsub_i16_high ; CHECK: uqsub z0.h, z0.h, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i16 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.usub.sat.nxv8i16( %a, %splat) ret %res } define @uqsub_i32_low( %a) { ; CHECK-LABEL: uqsub_i32_low ; CHECK: uqsub z0.s, z0.s, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i32 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.usub.sat.nxv4i32( %a, %splat) ret %res } define @uqsub_i32_high( %a) { ; CHECK-LABEL: uqsub_i32_high ; CHECK: uqsub z0.s, z0.s, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i32 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.usub.sat.nxv4i32( %a, %splat) ret %res } define @uqsub_i64_low( %a) { ; CHECK-LABEL: uqsub_i64_low ; CHECK: uqsub z0.d, z0.d, #30 ; CHECK-NEXT: ret %elt = insertelement undef, i64 30, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.usub.sat.nxv2i64( %a, %splat) ret %res } define @uqsub_i64_high( %a) { ; CHECK-LABEL: uqsub_i64_high ; CHECK: uqsub z0.d, z0.d, #1024 ; CHECK-NEXT: ret %elt = insertelement undef, i64 1024, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = call @llvm.usub.sat.nxv2i64( %a, %splat) ret %res } declare @llvm.sadd.sat.nxv16i8(, ) declare @llvm.sadd.sat.nxv8i16(, ) declare @llvm.sadd.sat.nxv4i32(, ) declare @llvm.sadd.sat.nxv2i64(, ) declare @llvm.uadd.sat.nxv16i8(, ) declare @llvm.uadd.sat.nxv8i16(, ) declare @llvm.uadd.sat.nxv4i32(, ) declare @llvm.uadd.sat.nxv2i64(, ) declare @llvm.ssub.sat.nxv16i8(, ) declare @llvm.ssub.sat.nxv8i16(, ) declare @llvm.ssub.sat.nxv4i32(, ) declare @llvm.ssub.sat.nxv2i64(, ) declare @llvm.usub.sat.nxv16i8(, ) declare @llvm.usub.sat.nxv8i16(, ) declare @llvm.usub.sat.nxv4i32(, ) declare @llvm.usub.sat.nxv2i64(, )