Index: clang/include/clang/Basic/arm_sve.td =================================================================== --- clang/include/clang/Basic/arm_sve.td +++ clang/include/clang/Basic/arm_sve.td @@ -617,6 +617,13 @@ def SVDUPQ_32 : SInst<"svdupq[_n]_{d}", "dssss", "iUif", MergeNone>; def SVDUPQ_64 : SInst<"svdupq[_n]_{d}", "dss", "lUld", MergeNone>; +def SVDUP : SInst<"svdup[_n]_{d}", "ds", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_dup_x">; +def SVDUP_M : SInst<"svdup[_n]_{d}", "ddPs", "csilUcUsUiUlhfd", MergeOp1, "aarch64_sve_dup">; +def SVDUP_X : SInst<"svdup[_n]_{d}", "dPs", "csilUcUsUiUlhfd", MergeAnyExp, "aarch64_sve_dup">; +def SVDUP_Z : SInst<"svdup[_n]_{d}", "dPs", "csilUcUsUiUlhfd", MergeZeroExp, "aarch64_sve_dup">; + +def SVINDEX : SInst<"svindex_{d}", "dss", "csilUcUsUiUl", MergeNone, "aarch64_sve_index">; + // Integer arithmetic multiclass SInstZPZ flags=[]> { @@ -1040,7 +1047,7 @@ def SVCLASTB : SInst<"svclastb[_{d}]", "dPdd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_clastb">; def SVCLASTB_N : SInst<"svclastb[_n_{d}]", "sPsd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_clastb_n">; def SVCOMPACT : SInst<"svcompact[_{d}]", "dPd", "ilUiUlfd", MergeNone, "aarch64_sve_compact">; -// SVDUP_LANE (to land in D78750) +def SVDUP_LANE : SInst<"svdup_lane[_{d}]", "ddL", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_tbl">; // Implemented using tbl def SVDUPQ_LANE : SInst<"svdupq_lane[_{d}]", "ddn", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_dupq_lane">; def SVEXT : SInst<"svext[_{d}]", "dddi", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_ext", [], [ImmCheck<2, ImmCheckExtract, 1>]>; def SVLASTA : SInst<"svlasta[_{d}]", "sPd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_lasta">; @@ -1083,6 +1090,7 @@ def SVDUPQ_B16 : SInst<"svdupq[_n]_{d}", "Pssssssss", "Ps", MergeNone>; def SVDUPQ_B32 : SInst<"svdupq[_n]_{d}", "Pssss", "Pi", MergeNone>; def SVDUPQ_B64 : SInst<"svdupq[_n]_{d}", "Pss", "Pl", MergeNone>; +def SVDUP_N_B : SInst<"svdup[_n]_{d}", "Ps", "PcPsPiPl", MergeNone>; //////////////////////////////////////////////////////////////////////////////// Index: clang/lib/CodeGen/CGBuiltin.cpp =================================================================== --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -8034,6 +8034,20 @@ return Builder.CreateCall(F, {Ops[0], Ops[1], Ops[0]}); } + case SVE::BI__builtin_sve_svdup_n_b8: + case SVE::BI__builtin_sve_svdup_n_b16: + case SVE::BI__builtin_sve_svdup_n_b32: + case SVE::BI__builtin_sve_svdup_n_b64: { + Value *CmpNE = Builder.CreateICmpNE( + Ops[0], Constant::getNullValue(Ops[0]->getType())); + + SVETypeFlags TypeFlags(Builtin->TypeModifier); + Value *PTrue = EmitSVEAllTruePred(TypeFlags); + Value *PFalse = Constant::getNullValue(PTrue->getType()); + Value *Sel = Builder.CreateSelect(CmpNE, PTrue, PFalse); + return EmitSVEPredicateCast(Sel, cast(Ty)); + } + case SVE::BI__builtin_sve_svdupq_n_b8: case SVE::BI__builtin_sve_svdupq_n_b16: case SVE::BI__builtin_sve_svdupq_n_b32: Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_dup.c =================================================================== --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_dup.c @@ -0,0 +1,528 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s + +#include + +#ifdef SVE_OVERLOADED_FORMS +// A simple used,unused... macro, long enough to represent any SVE builtin. +#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 +#else +#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 +#endif + +svint8_t test_svdup_n_s8(int8_t op) +{ + // CHECK-LABEL: test_svdup_n_s8 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv16i8(i8 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s8,)(op); +} + +svint16_t test_svdup_n_s16(int16_t op) +{ + // CHECK-LABEL: test_svdup_n_s16 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv8i16(i16 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s16,)(op); +} + +svint32_t test_svdup_n_s32(int32_t op) +{ + // CHECK-LABEL: test_svdup_n_s32 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s32,)(op); +} + +svint64_t test_svdup_n_s64(int64_t op) +{ + // CHECK-LABEL: test_svdup_n_s64 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s64,)(op); +} + +svuint8_t test_svdup_n_u8(uint8_t op) +{ + // CHECK-LABEL: test_svdup_n_u8 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv16i8(i8 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u8,)(op); +} + +svuint16_t test_svdup_n_u16(uint16_t op) +{ + // CHECK-LABEL: test_svdup_n_u16 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv8i16(i16 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u16,)(op); +} + +svuint32_t test_svdup_n_u32(uint32_t op) +{ + // CHECK-LABEL: test_svdup_n_u32 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u32,)(op); +} + +svuint64_t test_svdup_n_u64(uint64_t op) +{ + // CHECK-LABEL: test_svdup_n_u64 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u64,)(op); +} + +svfloat16_t test_svdup_n_f16(float16_t op) +{ + // CHECK-LABEL: test_svdup_n_f16 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv8f16(half %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f16,)(op); +} + +svfloat32_t test_svdup_n_f32(float32_t op) +{ + // CHECK-LABEL: test_svdup_n_f32 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv4f32(float %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f32,)(op); +} + +svfloat64_t test_svdup_n_f64(float64_t op) +{ + // CHECK-LABEL: test_svdup_n_f64 + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.x.nxv2f64(double %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f64,)(op); +} + +svint8_t test_svdup_n_s8_z(svbool_t pg, int8_t op) +{ + // CHECK-LABEL: test_svdup_n_s8_z + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv16i8( zeroinitializer, %pg, i8 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s8_z,)(pg, op); +} + +svint16_t test_svdup_n_s16_z(svbool_t pg, int16_t op) +{ + // CHECK-LABEL: test_svdup_n_s16_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv8i16( zeroinitializer, %[[PG]], i16 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s16_z,)(pg, op); +} + +svint32_t test_svdup_n_s32_z(svbool_t pg, int32_t op) +{ + // CHECK-LABEL: test_svdup_n_s32_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv4i32( zeroinitializer, %[[PG]], i32 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s32_z,)(pg, op); +} + +svint64_t test_svdup_n_s64_z(svbool_t pg, int64_t op) +{ + // CHECK-LABEL: test_svdup_n_s64_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv2i64( zeroinitializer, %[[PG]], i64 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s64_z,)(pg, op); +} + +svuint8_t test_svdup_n_u8_z(svbool_t pg, uint8_t op) +{ + // CHECK-LABEL: test_svdup_n_u8_z + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv16i8( zeroinitializer, %pg, i8 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u8_z,)(pg, op); +} + +svuint16_t test_svdup_n_u16_z(svbool_t pg, uint16_t op) +{ + // CHECK-LABEL: test_svdup_n_u16_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv8i16( zeroinitializer, %[[PG]], i16 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u16_z,)(pg, op); +} + +svuint32_t test_svdup_n_u32_z(svbool_t pg, uint32_t op) +{ + // CHECK-LABEL: test_svdup_n_u32_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv4i32( zeroinitializer, %[[PG]], i32 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u32_z,)(pg, op); +} + +svuint64_t test_svdup_n_u64_z(svbool_t pg, uint64_t op) +{ + // CHECK-LABEL: test_svdup_n_u64_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv2i64( zeroinitializer, %[[PG]], i64 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u64_z,)(pg, op); +} + +svfloat16_t test_svdup_n_f16_z(svbool_t pg, float16_t op) +{ + // CHECK-LABEL: test_svdup_n_f16_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv8f16( zeroinitializer, %[[PG]], half %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f16_z,)(pg, op); +} + +svfloat32_t test_svdup_n_f32_z(svbool_t pg, float32_t op) +{ + // CHECK-LABEL: test_svdup_n_f32_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv4f32( zeroinitializer, %[[PG]], float %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f32_z,)(pg, op); +} + +svfloat64_t test_svdup_n_f64_z(svbool_t pg, float64_t op) +{ + // CHECK-LABEL: test_svdup_n_f64_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv2f64( zeroinitializer, %[[PG]], double %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f64_z,)(pg, op); +} + +svint8_t test_svdup_n_s8_m(svint8_t inactive, svbool_t pg, int8_t op) +{ + // CHECK-LABEL: test_svdup_n_s8_m + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv16i8( %inactive, %pg, i8 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s8_m,)(inactive, pg, op); +} + +svint16_t test_svdup_n_s16_m(svint16_t inactive, svbool_t pg, int16_t op) +{ + // CHECK-LABEL: test_svdup_n_s16_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv8i16( %inactive, %[[PG]], i16 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s16_m,)(inactive, pg, op); +} + +svint32_t test_svdup_n_s32_m(svint32_t inactive, svbool_t pg, int32_t op) +{ + // CHECK-LABEL: test_svdup_n_s32_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv4i32( %inactive, %[[PG]], i32 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s32_m,)(inactive, pg, op); +} + +svint64_t test_svdup_n_s64_m(svint64_t inactive, svbool_t pg, int64_t op) +{ + // CHECK-LABEL: test_svdup_n_s64_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv2i64( %inactive, %[[PG]], i64 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s64_m,)(inactive, pg, op); +} + +svuint8_t test_svdup_n_u8_m(svuint8_t inactive, svbool_t pg, uint8_t op) +{ + // CHECK-LABEL: test_svdup_n_u8_m + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv16i8( %inactive, %pg, i8 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u8_m,)(inactive, pg, op); +} + +svuint16_t test_svdup_n_u16_m(svuint16_t inactive, svbool_t pg, uint16_t op) +{ + // CHECK-LABEL: test_svdup_n_u16_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv8i16( %inactive, %[[PG]], i16 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u16_m,)(inactive, pg, op); +} + +svuint32_t test_svdup_n_u32_m(svuint32_t inactive, svbool_t pg, uint32_t op) +{ + // CHECK-LABEL: test_svdup_n_u32_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv4i32( %inactive, %[[PG]], i32 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u32_m,)(inactive, pg, op); +} + +svuint64_t test_svdup_n_u64_m(svuint64_t inactive, svbool_t pg, uint64_t op) +{ + // CHECK-LABEL: test_svdup_n_u64_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv2i64( %inactive, %[[PG]], i64 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u64_m,)(inactive, pg, op); +} + +svfloat16_t test_svdup_n_f16_m(svfloat16_t inactive, svbool_t pg, float16_t op) +{ + // CHECK-LABEL: test_svdup_n_f16_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv8f16( %inactive, %[[PG]], half %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f16_m,)(inactive, pg, op); +} + +svfloat32_t test_svdup_n_f32_m(svfloat32_t inactive, svbool_t pg, float32_t op) +{ + // CHECK-LABEL: test_svdup_n_f32_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv4f32( %inactive, %[[PG]], float %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f32_m,)(inactive, pg, op); +} + +svfloat64_t test_svdup_n_f64_m(svfloat64_t inactive, svbool_t pg, float64_t op) +{ + // CHECK-LABEL: test_svdup_n_f64_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv2f64( %inactive, %[[PG]], double %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f64_m,)(inactive, pg, op); +} + +svint8_t test_svdup_n_s8_x(svbool_t pg, int8_t op) +{ + // CHECK-LABEL: test_svdup_n_s8_x + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv16i8( undef, %pg, i8 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s8_x,)(pg, op); +} + +svint16_t test_svdup_n_s16_x(svbool_t pg, int16_t op) +{ + // CHECK-LABEL: test_svdup_n_s16_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv8i16( undef, %[[PG]], i16 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s16_x,)(pg, op); +} + +svint32_t test_svdup_n_s32_x(svbool_t pg, int32_t op) +{ + // CHECK-LABEL: test_svdup_n_s32_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv4i32( undef, %[[PG]], i32 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s32_x,)(pg, op); +} + +svint64_t test_svdup_n_s64_x(svbool_t pg, int64_t op) +{ + // CHECK-LABEL: test_svdup_n_s64_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv2i64( undef, %[[PG]], i64 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_s64_x,)(pg, op); +} + +svuint8_t test_svdup_n_u8_x(svbool_t pg, uint8_t op) +{ + // CHECK-LABEL: test_svdup_n_u8_x + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv16i8( undef, %pg, i8 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u8_x,)(pg, op); +} + +svuint16_t test_svdup_n_u16_x(svbool_t pg, uint16_t op) +{ + // CHECK-LABEL: test_svdup_n_u16_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv8i16( undef, %[[PG]], i16 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u16_x,)(pg, op); +} + +svuint32_t test_svdup_n_u32_x(svbool_t pg, uint32_t op) +{ + // CHECK-LABEL: test_svdup_n_u32_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv4i32( undef, %[[PG]], i32 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u32_x,)(pg, op); +} + +svuint64_t test_svdup_n_u64_x(svbool_t pg, uint64_t op) +{ + // CHECK-LABEL: test_svdup_n_u64_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv2i64( undef, %[[PG]], i64 %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_u64_x,)(pg, op); +} + +svfloat16_t test_svdup_n_f16_x(svbool_t pg, float16_t op) +{ + // CHECK-LABEL: test_svdup_n_f16_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv8f16( undef, %[[PG]], half %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f16_x,)(pg, op); +} + +svfloat32_t test_svdup_n_f32_x(svbool_t pg, float32_t op) +{ + // CHECK-LABEL: test_svdup_n_f32_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv4f32( undef, %[[PG]], float %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f32_x,)(pg, op); +} + +svfloat64_t test_svdup_n_f64_x(svbool_t pg, float64_t op) +{ + // CHECK-LABEL: test_svdup_n_f64_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.dup.nxv2f64( undef, %[[PG]], double %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup,_n,_f64_x,)(pg, op); +} + +svint8_t test_svdup_lane_s8(svint8_t data, uint8_t index) +{ + // CHECK-LABEL: test_svdup_lane_s8 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv16i8(i8 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv16i8( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_s8,,)(data, index); +} + +svint16_t test_svdup_lane_s16(svint16_t data, uint16_t index) +{ + // CHECK-LABEL: test_svdup_lane_s16 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv8i16(i16 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv8i16( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_s16,,)(data, index); +} + +svint32_t test_svdup_lane_s32(svint32_t data, uint32_t index) +{ + // CHECK-LABEL: test_svdup_lane_s32 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv4i32(i32 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv4i32( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_s32,,)(data, index); +} + +svint64_t test_svdup_lane_s64(svint64_t data, uint64_t index) +{ + // CHECK-LABEL: test_svdup_lane_s64 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv2i64(i64 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv2i64( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_s64,,)(data, index); +} + +svuint8_t test_svdup_lane_u8(svuint8_t data, uint8_t index) +{ + // CHECK-LABEL: test_svdup_lane_u8 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv16i8(i8 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv16i8( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_u8,,)(data, index); +} + +svuint16_t test_svdup_lane_u16(svuint16_t data, uint16_t index) +{ + // CHECK-LABEL: test_svdup_lane_u16 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv8i16(i16 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv8i16( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_u16,,)(data, index); +} + +svuint32_t test_svdup_lane_u32(svuint32_t data, uint32_t index) +{ + // CHECK-LABEL: test_svdup_lane_u32 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv4i32(i32 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv4i32( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_u32,,)(data, index); +} + +svuint64_t test_svdup_lane_u64(svuint64_t data, uint64_t index) +{ + // CHECK-LABEL: test_svdup_lane_u64 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv2i64(i64 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv2i64( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_u64,,)(data, index); +} + +svfloat16_t test_svdup_lane_f16(svfloat16_t data, uint16_t index) +{ + // CHECK-LABEL: test_svdup_lane_f16 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv8i16(i16 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv8f16( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_f16,,)(data, index); +} + +svfloat32_t test_svdup_lane_f32(svfloat32_t data, uint32_t index) +{ + // CHECK-LABEL: test_svdup_lane_f32 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv4i32(i32 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv4f32( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_f32,,)(data, index); +} + +svfloat64_t test_svdup_lane_f64(svfloat64_t data, uint64_t index) +{ + // CHECK-LABEL: test_svdup_lane_f64 + // CHECK: %[[DUP:.*]] = call @llvm.aarch64.sve.dup.x.nxv2i64(i64 %index) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.tbl.nxv2f64( %data, %[[DUP]]) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svdup_lane,_f64,,)(data, index); +} + +svbool_t test_svdup_n_b8(bool op) +{ + // CHECK-LABEL: test_svdup_n_b8 + // CHECK: %[[PTRUE:.*]] = call @llvm.aarch64.sve.ptrue.nxv16i1(i32 31) + // CHECK: %[[SEL:.*]] = select i1 %op, %[[PTRUE]], zeroinitializer + // CHECK: ret %[[SEL]] + return SVE_ACLE_FUNC(svdup,_n,_b8,)(op); +} + +svbool_t test_svdup_n_b16(bool op) +{ + // CHECK-LABEL: test_svdup_n_b16 + // CHECK: %[[PTRUE:.*]] = call @llvm.aarch64.sve.ptrue.nxv8i1(i32 31) + // CHECK: %[[SEL:.*]] = select i1 %op, %[[PTRUE]], zeroinitializer + // CHECK: %[[CVT:.*]] = call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( %[[SEL]]) + // CHECK: ret %[[CVT]] + return SVE_ACLE_FUNC(svdup,_n,_b16,)(op); +} + +svbool_t test_svdup_n_b32(bool op) +{ + // CHECK-LABEL: test_svdup_n_b32 + // CHECK: %[[PTRUE:.*]] = call @llvm.aarch64.sve.ptrue.nxv4i1(i32 31) + // CHECK: %[[SEL:.*]] = select i1 %op, %[[PTRUE]], zeroinitializer + // CHECK: %[[CVT:.*]] = call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( %[[SEL]]) + // CHECK: ret %[[CVT]] + return SVE_ACLE_FUNC(svdup,_n,_b32,)(op); +} + +svbool_t test_svdup_n_b64(bool op) +{ + // CHECK-LABEL: test_svdup_n_b64 + // CHECK: %[[PTRUE:.*]] = call @llvm.aarch64.sve.ptrue.nxv2i1(i32 31) + // CHECK: %[[SEL:.*]] = select i1 %op, %[[PTRUE]], zeroinitializer + // CHECK: %[[CVT:.*]] = call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( %[[SEL]]) + // CHECK: ret %[[CVT]] + return SVE_ACLE_FUNC(svdup,_n,_b64,)(op); +}