Index: clang/include/clang/Basic/arm_sve.td =================================================================== --- clang/include/clang/Basic/arm_sve.td +++ clang/include/clang/Basic/arm_sve.td @@ -296,6 +296,18 @@ // Store one vector, with no truncation, non-temporal (scalar base, VL displacement) def SVSTNT1_VNUM : MInst<"svstnt1_vnum[_{d}]", "vPpld", "csilUcUsUiUlhfd", [IsStore], MemEltTyDefault, "aarch64_sve_stnt1">; +//////////////////////////////////////////////////////////////////////////////// +// Integer arithmetic + +multiclass SInstZPZ flags=[]> { + def _M : SInst; + def _X : SInst; + def _Z : SInst; +} + +defm SVABS : SInstZPZ<"svabs", "csil", "aarch64_sve_abs">; +defm SVNEG : SInstZPZ<"svneg", "csil", "aarch64_sve_neg">; + //////////////////////////////////////////////////////////////////////////////// // Permutations and selection def SVEXT : SInst<"svext[_{d}]", "dddi", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_ext", [], [ImmCheck<2, ImmCheckExtract, 1>]>; @@ -318,6 +330,10 @@ //////////////////////////////////////////////////////////////////////////////// // Floating-point arithmetic + +defm SVABS_F : SInstZPZ<"svabs", "hfd", "aarch64_sve_fabs">; +defm SVNEG_F : SInstZPZ<"svneg", "hfd", "aarch64_sve_fneg">; + def SVTMAD : SInst<"svtmad[_{d}]", "dddi", "hfd", MergeNone, "aarch64_sve_ftmad_x", [], [ImmCheck<2, ImmCheck0_7>]>; def SVMLA_LANE : SInst<"svmla_lane[_{d}]", "ddddi", "hfd", MergeNone, "aarch64_sve_fmla_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>; Index: clang/lib/CodeGen/CGBuiltin.cpp =================================================================== --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -7562,6 +7562,18 @@ return Builder.CreateCall(F, {Val, Predicate, BasePtr}); } +static void InsertExplicitZeroOperand(CGBuilderTy &Builder, llvm::Type *Ty, + SmallVectorImpl &Ops) { + auto *SplatZero = Constant::getNullValue(Ty); + Ops.insert(Ops.begin(), SplatZero); +} + +static void InsertExplicitUndefOperand(CGBuilderTy &Builder, llvm::Type *Ty, + SmallVectorImpl &Ops) { + auto *SplatUndef = UndefValue::get(Ty); + Ops.insert(Ops.begin(), SplatUndef); +} + Value *CodeGenFunction::EmitAArch64SVEBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { // Find out if any arguments are required to be integer constant expressions. @@ -7601,6 +7613,12 @@ else if (Builtin->LLVMIntrinsic != 0) { llvm::Type* OverloadedTy = getSVEType(TypeFlags); + if (TypeFlags.getMergeType() == SVETypeFlags::MergeZeroExp) + InsertExplicitZeroOperand(Builder, Ty, Ops); + + if (TypeFlags.getMergeType() == SVETypeFlags::MergeAnyExp) + InsertExplicitUndefOperand(Builder, Ty, Ops); + // Predicates must match the main datatype. for (unsigned i = 0, e = Ops.size(); i != e; ++i) { if (auto PredTy = dyn_cast(Ops[i]->getType())) Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_abs.c =================================================================== --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_abs.c @@ -0,0 +1,197 @@ +// 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_svabs_s8_z(svbool_t pg, svint8_t op) +{ + // CHECK-LABEL: test_svabs_s8_z + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv16i8( zeroinitializer, %pg, %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s8,_z,)(pg, op); +} + +svint16_t test_svabs_s16_z(svbool_t pg, svint16_t op) +{ + // CHECK-LABEL: test_svabs_s16_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv8i16( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s16,_z,)(pg, op); +} + +svint32_t test_svabs_s32_z(svbool_t pg, svint32_t op) +{ + // CHECK-LABEL: test_svabs_s32_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv4i32( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s32,_z,)(pg, op); +} + +svint64_t test_svabs_s64_z(svbool_t pg, svint64_t op) +{ + // CHECK-LABEL: test_svabs_s64_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv2i64( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s64,_z,)(pg, op); +} + +svint8_t test_svabs_s8_m(svint8_t inactive, svbool_t pg, svint8_t op) +{ + // CHECK-LABEL: test_svabs_s8_m + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv16i8( %inactive, %pg, %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s8,_m,)(inactive, pg, op); +} + +svint16_t test_svabs_s16_m(svint16_t inactive, svbool_t pg, svint16_t op) +{ + // CHECK-LABEL: test_svabs_s16_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv8i16( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s16,_m,)(inactive, pg, op); +} + +svint32_t test_svabs_s32_m(svint32_t inactive, svbool_t pg, svint32_t op) +{ + // CHECK-LABEL: test_svabs_s32_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv4i32( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s32,_m,)(inactive, pg, op); +} + +svint64_t test_svabs_s64_m(svint64_t inactive, svbool_t pg, svint64_t op) +{ + // CHECK-LABEL: test_svabs_s64_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv2i64( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s64,_m,)(inactive, pg, op); +} + +svint8_t test_svabs_s8_x(svbool_t pg, svint8_t op) +{ + // CHECK-LABEL: test_svabs_s8_x + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv16i8( undef, %pg, %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s8,_x,)(pg, op); +} + +svint16_t test_svabs_s16_x(svbool_t pg, svint16_t op) +{ + // CHECK-LABEL: test_svabs_s16_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv8i16( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s16,_x,)(pg, op); +} + +svint32_t test_svabs_s32_x(svbool_t pg, svint32_t op) +{ + // CHECK-LABEL: test_svabs_s32_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv4i32( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s32,_x,)(pg, op); +} + +svint64_t test_svabs_s64_x(svbool_t pg, svint64_t op) +{ + // CHECK-LABEL: test_svabs_s64_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.abs.nxv2i64( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_s64,_x,)(pg, op); +} + +svfloat16_t test_svabs_f16_z(svbool_t pg, svfloat16_t op) +{ + // CHECK-LABEL: test_svabs_f16_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fabs.nxv8f16( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_f16,_z,)(pg, op); +} + +svfloat32_t test_svabs_f32_z(svbool_t pg, svfloat32_t op) +{ + // CHECK-LABEL: test_svabs_f32_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fabs.nxv4f32( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_f32,_z,)(pg, op); +} + +svfloat64_t test_svabs_f64_z(svbool_t pg, svfloat64_t op) +{ + // CHECK-LABEL: test_svabs_f64_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fabs.nxv2f64( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_f64,_z,)(pg, op); +} + +svfloat16_t test_svabs_f16_m(svfloat16_t inactive, svbool_t pg, svfloat16_t op) +{ + // CHECK-LABEL: test_svabs_f16_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fabs.nxv8f16( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_f16,_m,)(inactive, pg, op); +} + +svfloat32_t test_svabs_f32_m(svfloat32_t inactive, svbool_t pg, svfloat32_t op) +{ + // CHECK-LABEL: test_svabs_f32_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fabs.nxv4f32( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_f32,_m,)(inactive, pg, op); +} + +svfloat64_t test_svabs_f64_m(svfloat64_t inactive, svbool_t pg, svfloat64_t op) +{ + // CHECK-LABEL: test_svabs_f64_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fabs.nxv2f64( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_f64,_m,)(inactive, pg, op); +} + +svfloat16_t test_svabs_f16_x(svbool_t pg, svfloat16_t op) +{ + // CHECK-LABEL: test_svabs_f16_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fabs.nxv8f16( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_f16,_x,)(pg, op); +} + +svfloat32_t test_svabs_f32_x(svbool_t pg, svfloat32_t op) +{ + // CHECK-LABEL: test_svabs_f32_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fabs.nxv4f32( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_f32,_x,)(pg, op); +} + +svfloat64_t test_svabs_f64_x(svbool_t pg, svfloat64_t op) +{ + // CHECK-LABEL: test_svabs_f64_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fabs.nxv2f64( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svabs,_f64,_x,)(pg, op); +} Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_neg.c =================================================================== --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_neg.c @@ -0,0 +1,197 @@ +// 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_svneg_s8_z(svbool_t pg, svint8_t op) +{ + // CHECK-LABEL: test_svneg_s8_z + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv16i8( zeroinitializer, %pg, %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s8,_z,)(pg, op); +} + +svint16_t test_svneg_s16_z(svbool_t pg, svint16_t op) +{ + // CHECK-LABEL: test_svneg_s16_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv8i16( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s16,_z,)(pg, op); +} + +svint32_t test_svneg_s32_z(svbool_t pg, svint32_t op) +{ + // CHECK-LABEL: test_svneg_s32_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv4i32( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s32,_z,)(pg, op); +} + +svint64_t test_svneg_s64_z(svbool_t pg, svint64_t op) +{ + // CHECK-LABEL: test_svneg_s64_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv2i64( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s64,_z,)(pg, op); +} + +svint8_t test_svneg_s8_m(svint8_t inactive, svbool_t pg, svint8_t op) +{ + // CHECK-LABEL: test_svneg_s8_m + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv16i8( %inactive, %pg, %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s8,_m,)(inactive, pg, op); +} + +svint16_t test_svneg_s16_m(svint16_t inactive, svbool_t pg, svint16_t op) +{ + // CHECK-LABEL: test_svneg_s16_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv8i16( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s16,_m,)(inactive, pg, op); +} + +svint32_t test_svneg_s32_m(svint32_t inactive, svbool_t pg, svint32_t op) +{ + // CHECK-LABEL: test_svneg_s32_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv4i32( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s32,_m,)(inactive, pg, op); +} + +svint64_t test_svneg_s64_m(svint64_t inactive, svbool_t pg, svint64_t op) +{ + // CHECK-LABEL: test_svneg_s64_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv2i64( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s64,_m,)(inactive, pg, op); +} + +svint8_t test_svneg_s8_x(svbool_t pg, svint8_t op) +{ + // CHECK-LABEL: test_svneg_s8_x + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv16i8( undef, %pg, %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s8,_x,)(pg, op); +} + +svint16_t test_svneg_s16_x(svbool_t pg, svint16_t op) +{ + // CHECK-LABEL: test_svneg_s16_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv8i16( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s16,_x,)(pg, op); +} + +svint32_t test_svneg_s32_x(svbool_t pg, svint32_t op) +{ + // CHECK-LABEL: test_svneg_s32_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv4i32( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s32,_x,)(pg, op); +} + +svint64_t test_svneg_s64_x(svbool_t pg, svint64_t op) +{ + // CHECK-LABEL: test_svneg_s64_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.neg.nxv2i64( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_s64,_x,)(pg, op); +} + +svfloat16_t test_svneg_f16_z(svbool_t pg, svfloat16_t op) +{ + // CHECK-LABEL: test_svneg_f16_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fneg.nxv8f16( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_f16,_z,)(pg, op); +} + +svfloat32_t test_svneg_f32_z(svbool_t pg, svfloat32_t op) +{ + // CHECK-LABEL: test_svneg_f32_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fneg.nxv4f32( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_f32,_z,)(pg, op); +} + +svfloat64_t test_svneg_f64_z(svbool_t pg, svfloat64_t op) +{ + // CHECK-LABEL: test_svneg_f64_z + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fneg.nxv2f64( zeroinitializer, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_f64,_z,)(pg, op); +} + +svfloat16_t test_svneg_f16_m(svfloat16_t inactive, svbool_t pg, svfloat16_t op) +{ + // CHECK-LABEL: test_svneg_f16_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fneg.nxv8f16( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_f16,_m,)(inactive, pg, op); +} + +svfloat32_t test_svneg_f32_m(svfloat32_t inactive, svbool_t pg, svfloat32_t op) +{ + // CHECK-LABEL: test_svneg_f32_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fneg.nxv4f32( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_f32,_m,)(inactive, pg, op); +} + +svfloat64_t test_svneg_f64_m(svfloat64_t inactive, svbool_t pg, svfloat64_t op) +{ + // CHECK-LABEL: test_svneg_f64_m + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fneg.nxv2f64( %inactive, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_f64,_m,)(inactive, pg, op); +} + +svfloat16_t test_svneg_f16_x(svbool_t pg, svfloat16_t op) +{ + // CHECK-LABEL: test_svneg_f16_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fneg.nxv8f16( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_f16,_x,)(pg, op); +} + +svfloat32_t test_svneg_f32_x(svbool_t pg, svfloat32_t op) +{ + // CHECK-LABEL: test_svneg_f32_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fneg.nxv4f32( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_f32,_x,)(pg, op); +} + +svfloat64_t test_svneg_f64_x(svbool_t pg, svfloat64_t op) +{ + // CHECK-LABEL: test_svneg_f64_x + // CHECK: %[[PG:.*]] = call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg) + // CHECK: %[[INTRINSIC:.*]] = call @llvm.aarch64.sve.fneg.nxv2f64( undef, %[[PG]], %op) + // CHECK: ret %[[INTRINSIC]] + return SVE_ACLE_FUNC(svneg,_f64,_x,)(pg, op); +}