diff --git a/clang/include/clang/Basic/arm_sve.td b/clang/include/clang/Basic/arm_sve.td index 073017532557b..8e2a232633358 100644 --- a/clang/include/clang/Basic/arm_sve.td +++ b/clang/include/clang/Basic/arm_sve.td @@ -2026,3 +2026,36 @@ let TargetGuard = "sme2" in { def SVADD_SINGLE_X2 : SInst<"svadd[_single_{d}_x2]", "22d", "cUcsUsiUilUl", MergeNone, "aarch64_sve_add_single_x2", [IsStreaming], []>; def SVADD_SINGLE_X4 : SInst<"svadd[_single_{d}_x4]", "44d", "cUcsUsiUilUl", MergeNone, "aarch64_sve_add_single_x4", [IsStreaming], []>; } + +let TargetGuard = "sve2p1" in { + // ZIPQ1, ZIPQ2, UZPQ1, UZPQ2 + def SVZIPQ1 : SInst<"svzipq1[_{d}]", "ddd", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_zipq1", [], []>; + def SVZIPQ2 : SInst<"svzipq2[_{d}]", "ddd", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_zipq2", [], []>; + def SVUZPQ1 : SInst<"svuzpq1[_{d}]", "ddd", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_uzpq1", [], []>; + def SVUZPQ2 : SInst<"svuzpq2[_{d}]", "ddd", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_uzpq2", [], []>; + // TBLQ, TBXQ + def SVTBLQ : SInst<"svtblq[_{d}]", "ddu", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_tblq">; + def SVTBXQ : SInst<"svtbxq[_{d}]", "dddu", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_tbxq">; + // EXTQ + def EXTQ : SInst<"svextq_lane[_{d}]", "dddk", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_extq_lane", [], [ImmCheck<2, ImmCheck0_15>]>; + // PMOV + // Move to Pred + multiclass PMOV_TO_PRED flags=[], ImmCheckType immCh > { + def _LANE : Inst]>; + def _LANE_ZERO : SInst; + } + defm SVPMOV_B_TO_PRED : PMOV_TO_PRED<"svpmov", "cUc", "aarch64_sve_pmov_to_pred_lane", [], ImmCheck0_0>; + defm SVPMOV_H_TO_PRED : PMOV_TO_PRED<"svpmov", "sUs", "aarch64_sve_pmov_to_pred_lane", [], ImmCheck0_1>; + defm SVPMOV_S_TO_PRED : PMOV_TO_PRED<"svpmov", "iUi", "aarch64_sve_pmov_to_pred_lane", [], ImmCheck0_3>; + defm SVPMOV_D_TO_PRED : PMOV_TO_PRED<"svpmov", "lUl", "aarch64_sve_pmov_to_pred_lane", [], ImmCheck0_7>; + + // Move to Vector + multiclass PMOV_TO_VEC flags=[], ImmCheckType immCh > { + def _M : SInst]>; + def _Z : SInst; + } + def SVPMOV_TO_VEC_LANE_B : SInst<"svpmov_{d}_z", "dP", "cUc", MergeNone, "aarch64_sve_pmov_to_vector_lane_zeroing", [], []>; + defm SVPMOV_TO_VEC_LANE_H : PMOV_TO_VEC<"svpmov", "sUs", "aarch64_sve_pmov_to_vector_lane", [], ImmCheck1_1>; + defm SVPMOV_TO_VEC_LANE_S : PMOV_TO_VEC<"svpmov", "iUi", "aarch64_sve_pmov_to_vector_lane", [], ImmCheck1_3>; + defm SVPMOV_TO_VEC_LANE_D : PMOV_TO_VEC<"svpmov", "lUl", "aarch64_sve_pmov_to_vector_lane" ,[], ImmCheck1_7>; +} diff --git a/clang/include/clang/Basic/arm_sve_sme_incl.td b/clang/include/clang/Basic/arm_sve_sme_incl.td index 22a2a3c5434d6..21dac067ab66e 100644 --- a/clang/include/clang/Basic/arm_sve_sme_incl.td +++ b/clang/include/clang/Basic/arm_sve_sme_incl.td @@ -249,6 +249,9 @@ def ImmCheck0_0 : ImmCheckType<16>; // 0..0 def ImmCheck0_15 : ImmCheckType<17>; // 0..15 def ImmCheck0_255 : ImmCheckType<18>; // 0..255 def ImmCheck2_4_Mul2 : ImmCheckType<19>; // 2, 4 +def ImmCheck1_1 : ImmCheckType<20>; // 1..1 +def ImmCheck1_3 : ImmCheckType<21>; // 1..3 +def ImmCheck1_7 : ImmCheckType<22>; // 1..7 class ImmCheck { int Arg = arg; diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index ae588db02bbe7..9dfff132cd88d 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3052,6 +3052,18 @@ bool Sema::CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { if (SemaBuiltinConstantArgRange(TheCall, ArgNum, 0, 7)) HasError = true; break; + case SVETypeFlags::ImmCheck1_1: + if (SemaBuiltinConstantArgRange(TheCall, ArgNum, 1, 1)) + HasError = true; + break; + case SVETypeFlags::ImmCheck1_3: + if (SemaBuiltinConstantArgRange(TheCall, ArgNum, 1, 3)) + HasError = true; + break; + case SVETypeFlags::ImmCheck1_7: + if (SemaBuiltinConstantArgRange(TheCall, ArgNum, 1, 7)) + HasError = true; + break; case SVETypeFlags::ImmCheckExtract: if (SemaBuiltinConstantArgRange(TheCall, ArgNum, 0, (2048 / ElementSizeInBits) - 1)) diff --git a/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_extq.c b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_extq.c new file mode 100644 index 0000000000000..7704db5667a2a --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_extq.c @@ -0,0 +1,213 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -o /dev/null %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 + +// CHECK-LABEL: define dso_local @test_svextq_lane_u8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv16i8( [[ZN]], [[ZM]], i32 0) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z19test_svextq_lane_u8u11__SVUint8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv16i8( [[ZN]], [[ZM]], i32 0) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint8_t test_svextq_lane_u8(svuint8_t zn, svuint8_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _u8,,)(zn, zm, 0); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_s8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv16i8( [[ZN]], [[ZM]], i32 4) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z19test_svextq_lane_s8u10__SVInt8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv16i8( [[ZN]], [[ZM]], i32 4) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint8_t test_svextq_lane_s8(svint8_t zn, svint8_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _s8,,)(zn, zm, 4); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_u16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv8i16( [[ZN]], [[ZM]], i32 1) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svextq_lane_u16u12__SVUint16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv8i16( [[ZN]], [[ZM]], i32 1) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint16_t test_svextq_lane_u16(svuint16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _u16,,)(zn, zm, 1); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_s16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv8i16( [[ZN]], [[ZM]], i32 5) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svextq_lane_s16u11__SVInt16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv8i16( [[ZN]], [[ZM]], i32 5) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint16_t test_svextq_lane_s16(svint16_t zn, svint16_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _s16,,)(zn, zm, 5); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_u32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv4i32( [[ZN]], [[ZM]], i32 2) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svextq_lane_u32u12__SVUint32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv4i32( [[ZN]], [[ZM]], i32 2) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint32_t test_svextq_lane_u32(svuint32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _u32,,)(zn, zm, 2); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_s32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv4i32( [[ZN]], [[ZM]], i32 6) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svextq_lane_s32u11__SVInt32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv4i32( [[ZN]], [[ZM]], i32 6) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint32_t test_svextq_lane_s32(svint32_t zn, svint32_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _s32,,)(zn, zm, 6); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_u64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv2i64( [[ZN]], [[ZM]], i32 3) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svextq_lane_u64u12__SVUint64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv2i64( [[ZN]], [[ZM]], i32 3) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint64_t test_svextq_lane_u64(svuint64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _u64,,)(zn, zm, 3); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_s64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv2i64( [[ZN]], [[ZM]], i32 7) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svextq_lane_s64u11__SVInt64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv2i64( [[ZN]], [[ZM]], i32 7) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint64_t test_svextq_lane_s64(svint64_t zn, svint64_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _s64,,)(zn, zm, 7); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_f16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv8f16( [[ZN]], [[ZM]], i32 8) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svextq_lane_f16u13__SVFloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv8f16( [[ZN]], [[ZM]], i32 8) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat16_t test_svextq_lane_f16(svfloat16_t zn, svfloat16_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _f16,,)(zn, zm, 8); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_f32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv4f32( [[ZN]], [[ZM]], i32 9) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svextq_lane_f32u13__SVFloat32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv4f32( [[ZN]], [[ZM]], i32 9) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat32_t test_svextq_lane_f32(svfloat32_t zn, svfloat32_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _f32,,)(zn, zm, 9); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_f64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv2f64( [[ZN]], [[ZM]], i32 10) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svextq_lane_f64u13__SVFloat64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv2f64( [[ZN]], [[ZM]], i32 10) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat64_t test_svextq_lane_f64(svfloat64_t zn, svfloat64_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _f64,,)(zn, zm, 10); +} + +// CHECK-LABEL: define dso_local @test_svextq_lane_bf16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv8bf16( [[ZN]], [[ZM]], i32 11) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z21test_svextq_lane_bf16u14__SVBfloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.extq.lane.nxv8bf16( [[ZN]], [[ZM]], i32 11) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbfloat16_t test_svextq_lane_bf16(svbfloat16_t zn, svbfloat16_t zm) { + return SVE_ACLE_FUNC(svextq_lane, _bf16,,)(zn, zm, 11); +} diff --git a/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_pmov_to_pred.c b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_pmov_to_pred.c new file mode 100644 index 0000000000000..84f058ad8c16d --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_pmov_to_pred.c @@ -0,0 +1,304 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %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) A1 +#else +#define SVE_ACLE_FUNC(A1, A2) A1##A2 +#endif + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u8 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv16i8( [[ZN]], i32 0) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z19test_svpmov_lane_u8u11__SVUint8_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0:[0-9]+]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv16i8( [[ZN]], i32 0) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbool_t test_svpmov_lane_u8(svuint8_t zn) { + return SVE_ACLE_FUNC(svpmov_lane, _u8)(zn, 0); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s8 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv16i8( [[ZN]], i32 0) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z19test_svpmov_lane_s8u10__SVInt8_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv16i8( [[ZN]], i32 0) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbool_t test_svpmov_lane_s8(svint8_t zn) { + return SVE_ACLE_FUNC(svpmov_lane, _s8)(zn, 0); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u16 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv8i16( [[ZN]], i32 0) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svpmov_lane_u16u12__SVUint16_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv8i16( [[ZN]], i32 0) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_lane_u16(svuint16_t zn) { + return SVE_ACLE_FUNC(svpmov_lane, _u16)(zn, 0); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s16 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv8i16( [[ZN]], i32 1) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svpmov_lane_s16u11__SVInt16_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv8i16( [[ZN]], i32 1) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_lane_s16(svint16_t zn) { + return SVE_ACLE_FUNC(svpmov_lane, _s16)(zn, 1); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u32 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv4i32( [[ZN]], i32 0) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svpmov_lane_u32u12__SVUint32_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv4i32( [[ZN]], i32 0) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_lane_u32(svuint32_t zn) { + return SVE_ACLE_FUNC(svpmov_lane, _u32)(zn, 0); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s32 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv4i32( [[ZN]], i32 3) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svpmov_lane_s32u11__SVInt32_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv4i32( [[ZN]], i32 3) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_lane_s32(svint32_t zn) { + return SVE_ACLE_FUNC(svpmov_lane, _s32)(zn, 3); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u64 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv2i64( [[ZN]], i32 0) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svpmov_lane_u64u12__SVUint64_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv2i64( [[ZN]], i32 0) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_lane_u64(svuint64_t zn) { + return SVE_ACLE_FUNC(svpmov_lane, _u64)(zn, 0); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s64 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv2i64( [[ZN]], i32 7) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z20test_svpmov_lane_s64u11__SVInt64_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.nxv2i64( [[ZN]], i32 7) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_lane_s64(svint64_t zn) { + return SVE_ACLE_FUNC(svpmov_lane, _s64)(zn, 7); +} + + +// CHECK-LABEL: define dso_local @test_svpmov_u8 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv16i8( [[ZN]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z14test_svpmov_u8u11__SVUint8_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv16i8( [[ZN]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbool_t test_svpmov_u8(svuint8_t zn) { + return SVE_ACLE_FUNC(svpmov, _u8)(zn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_s8 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv16i8( [[ZN]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z14test_svpmov_s8u10__SVInt8_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv16i8( [[ZN]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbool_t test_svpmov_s8(svint8_t zn) { + return SVE_ACLE_FUNC(svpmov, _s8)(zn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_u16 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv8i16( [[ZN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svpmov_u16u12__SVUint16_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv8i16( [[ZN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_u16(svuint16_t zn) { + return SVE_ACLE_FUNC(svpmov, _u16)(zn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_s16 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv8i16( [[ZN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svpmov_s16u11__SVInt16_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv8i16( [[ZN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_s16(svint16_t zn) { + return SVE_ACLE_FUNC(svpmov, _s16)(zn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_u32 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv4i32( [[ZN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svpmov_u32u12__SVUint32_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv4i32( [[ZN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_u32(svuint32_t zn) { + return SVE_ACLE_FUNC(svpmov, _u32)(zn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_s32 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv4i32( [[ZN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svpmov_s32u11__SVInt32_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv4i32( [[ZN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_s32(svint32_t zn) { + return SVE_ACLE_FUNC(svpmov, _s32)(zn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_u64 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv2i64( [[ZN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svpmov_u64u12__SVUint64_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv2i64( [[ZN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_u64(svuint64_t zn) { + return SVE_ACLE_FUNC(svpmov, _u64)(zn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_s64 +// CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv2i64( [[ZN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svpmov_s64u11__SVInt64_t +// CPP-CHECK-SAME: ( [[ZN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.pred.lane.zero.nxv2i64( [[ZN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svbool_t test_svpmov_s64(svint64_t zn) { + return SVE_ACLE_FUNC(svpmov, _s64)(zn); +} + diff --git a/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_pmov_to_vector.c b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_pmov_to_vector.c new file mode 100644 index 0000000000000..1e45f1ecedce5 --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_pmov_to_vector.c @@ -0,0 +1,276 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1\ +// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %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) A1##A3 +#else +#define SVE_ACLE_FUNC(A1, A2, A3) A1##A2##A3 +#endif + +// _m + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u16_m +// CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv8i16( [[ZN]], [[TMP0]], i32 1) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_u16_mu12__SVUint16_tu10__SVBool_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0:[0-9]+]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv8i16( [[ZN]], [[TMP0]], i32 1) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svuint16_t test_svpmov_lane_u16_m(svuint16_t zn, svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_lane, _u16, _m)(zn, pn, 1); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s16_m +// CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv8i16( [[ZN]], [[TMP0]], i32 1) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_s16_mu11__SVInt16_tu10__SVBool_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv8i16( [[ZN]], [[TMP0]], i32 1) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svint16_t test_svpmov_lane_s16_m(svint16_t zn, svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_lane, _s16, _m)(zn, pn, 1); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u32_m +// CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv4i32( [[ZN]], [[TMP0]], i32 1) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_u32_mu12__SVUint32_tu10__SVBool_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv4i32( [[ZN]], [[TMP0]], i32 1) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svuint32_t test_svpmov_lane_u32_m(svuint32_t zn, svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_lane, _u32, _m)(zn, pn, 1); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s32_m +// CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv4i32( [[ZN]], [[TMP0]], i32 3) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_s32_mu11__SVInt32_tu10__SVBool_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv4i32( [[ZN]], [[TMP0]], i32 3) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svint32_t test_svpmov_lane_s32_m(svint32_t zn, svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_lane, _s32, _m)(zn, pn, 3); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u64_m +// CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv2i64( [[ZN]], [[TMP0]], i32 1) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_u64_mu12__SVUint64_tu10__SVBool_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv2i64( [[ZN]], [[TMP0]], i32 1) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svuint64_t test_svpmov_lane_u64_m(svuint64_t zn, svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_lane, _u64, _m)(zn, pn, 1); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s64_m +// CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv2i64( [[ZN]], [[TMP0]], i32 7) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_s64_mu11__SVInt64_tu10__SVBool_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv2i64( [[ZN]], [[TMP0]], i32 7) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svint64_t test_svpmov_lane_s64_m(svint64_t zn, svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_lane, _s64, _m)(zn, pn, 7); +} + + +// _z + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u8_z +// CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv16i8( [[PN]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z21test_svpmov_lane_u8_zu10__SVBool_t +// CPP-CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv16i8( [[PN]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint8_t test_svpmov_lane_u8_z(svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_u8, , _z)(pn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s8_z +// CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv16i8( [[PN]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z21test_svpmov_lane_s8_zu10__SVBool_t +// CPP-CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv16i8( [[PN]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint8_t test_svpmov_lane_s8_z(svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_s8, , _z)(pn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u16_z +// CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv8i16( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_u16_zu10__SVBool_t +// CPP-CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv8i16( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svuint16_t test_svpmov_lane_u16_z(svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_u16, , _z)(pn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s16_z +// CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv8i16( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_s16_zu10__SVBool_t +// CPP-CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv8i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv8i16( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svint16_t test_svpmov_lane_s16_z(svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_s16, , _z)(pn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u32_z +// CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv4i32( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_u32_zu10__SVBool_t +// CPP-CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv4i32( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svuint32_t test_svpmov_lane_u32_z(svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_u32, , _z)(pn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s32_z +// CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv4i32( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_s32_zu10__SVBool_t +// CPP-CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv4i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv4i32( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svint32_t test_svpmov_lane_s32_z(svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_s32, , _z)(pn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_u64_z +// CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv2i64( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_u64_zu10__SVBool_t +// CPP-CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv2i64( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svuint64_t test_svpmov_lane_u64_z(svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_u64, , _z)(pn); +} + +// CHECK-LABEL: define dso_local @test_svpmov_lane_s64_z +// CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( [[PN]]) +// CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv2i64( [[TMP0]]) +// CHECK-NEXT: ret [[TMP1]] +// +// CPP-CHECK-LABEL: define dso_local @_Z22test_svpmov_lane_s64_zu10__SVBool_t +// CPP-CHECK-SAME: ( [[PN:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.convert.from.svbool.nxv2i1( [[PN]]) +// CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv2i64( [[TMP0]]) +// CPP-CHECK-NEXT: ret [[TMP1]] +// +svint64_t test_svpmov_lane_s64_z(svbool_t pn) { + return SVE_ACLE_FUNC(svpmov_s64, , _z)(pn); +} + diff --git a/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_tblq.c b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_tblq.c new file mode 100644 index 0000000000000..6c04413c238a6 --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_tblq.c @@ -0,0 +1,214 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %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 + +// CHECK-LABEL: define dso_local @test_svtblq_u8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z14test_svtblq_u8u11__SVUint8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint8_t test_svtblq_u8(svuint8_t zn, svuint8_t zm) { + return SVE_ACLE_FUNC(svtblq, _u8,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_u16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtblq_u16u12__SVUint16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint16_t test_svtblq_u16(svuint16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svtblq, _u16,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_u32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtblq_u32u12__SVUint32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint32_t test_svtblq_u32(svuint32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svtblq, _u32,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_u64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtblq_u64u12__SVUint64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint64_t test_svtblq_u64(svuint64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svtblq, _u64,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_s8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z14test_svtblq_s8u10__SVInt8_tu11__SVUint8_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint8_t test_svtblq_s8(svint8_t zn, svuint8_t zm) { + return SVE_ACLE_FUNC(svtblq, _s8,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_s16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtblq_s16u11__SVInt16_tu12__SVUint16_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint16_t test_svtblq_s16(svint16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svtblq, _s16,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_s32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtblq_s32u11__SVInt32_tu12__SVUint32_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint32_t test_svtblq_s32(svint32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svtblq, _s32,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_s64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtblq_s64u11__SVInt64_tu12__SVUint64_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint64_t test_svtblq_s64(svint64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svtblq, _s64,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_f16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv8f16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtblq_f16u13__SVFloat16_tu12__SVUint16_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv8f16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat16_t test_svtblq_f16(svfloat16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svtblq, _f16,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_f32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv4f32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtblq_f32u13__SVFloat32_tu12__SVUint32_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv4f32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat32_t test_svtblq_f32(svfloat32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svtblq, _f32,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_f64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv2f64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtblq_f64u13__SVFloat64_tu12__SVUint64_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv2f64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat64_t test_svtblq_f64(svfloat64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svtblq, _f64,,)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtblq_bf16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv8bf16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svtblq_bf16u14__SVBfloat16_tu12__SVUint16_t +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tblq.nxv8bf16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbfloat16_t test_svtblq_bf16(svbfloat16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svtblq, _bf16,,)(zn, zm); +} diff --git a/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_tbxq.c b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_tbxq.c new file mode 100644 index 0000000000000..0ad7107b67670 --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_tbxq.c @@ -0,0 +1,214 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %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 + +// CHECK-LABEL: define dso_local @test_svtbxq_u8 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv16i8( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z14test_svtbxq_u8u11__SVUint8_tS_S_ +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv16i8( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint8_t test_svtbxq_u8(svuint8_t passthru, svuint8_t zn, svuint8_t zm) { + return SVE_ACLE_FUNC(svtbxq, _u8,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_u16 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv8i16( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtbxq_u16u12__SVUint16_tS_S_ +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv8i16( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint16_t test_svtbxq_u16(svuint16_t passthru, svuint16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svtbxq, _u16,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_u32 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv4i32( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtbxq_u32u12__SVUint32_tS_S_ +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv4i32( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint32_t test_svtbxq_u32(svuint32_t passthru, svuint32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svtbxq, _u32,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_u64 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv2i64( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtbxq_u64u12__SVUint64_tS_S_ +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv2i64( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint64_t test_svtbxq_u64(svuint64_t passthru, svuint64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svtbxq, _u64,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_s8 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv16i8( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z14test_svtbxq_s8u10__SVInt8_tS_u11__SVUint8_t +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv16i8( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint8_t test_svtbxq_s8(svint8_t passthru, svint8_t zn, svuint8_t zm) { + return SVE_ACLE_FUNC(svtbxq, _s8,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_s16 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv8i16( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtbxq_s16u11__SVInt16_tS_u12__SVUint16_t +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv8i16( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint16_t test_svtbxq_s16(svint16_t passthru, svint16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svtbxq, _s16,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_s32 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv4i32( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtbxq_s32u11__SVInt32_tS_u12__SVUint32_t +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv4i32( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint32_t test_svtbxq_s32(svint32_t passthru, svint32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svtbxq, _s32,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_s64 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv2i64( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtbxq_s64u11__SVInt64_tS_u12__SVUint64_t +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv2i64( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint64_t test_svtbxq_s64(svint64_t passthru, svint64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svtbxq, _s64,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_f16 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv8f16( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtbxq_f16u13__SVFloat16_tS_u12__SVUint16_t +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv8f16( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat16_t test_svtbxq_f16(svfloat16_t passthru, svfloat16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svtbxq, _f16,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_f32 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv4f32( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtbxq_f32u13__SVFloat32_tS_u12__SVUint32_t +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv4f32( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat32_t test_svtbxq_f32(svfloat32_t passthru, svfloat32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svtbxq, _f32,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_f64 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv2f64( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svtbxq_f64u13__SVFloat64_tS_u12__SVUint64_t +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv2f64( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat64_t test_svtbxq_f64(svfloat64_t passthru, svfloat64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svtbxq, _f64,,)(passthru, zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svtbxq_bf16 +// CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv8bf16( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svtbxq_bf16u14__SVBfloat16_tS_u12__SVUint16_t +// CPP-CHECK-SAME: ( [[PASSTHRU:%.*]], [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.tbxq.nxv8bf16( [[PASSTHRU]], [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbfloat16_t test_svtbxq_bf16(svbfloat16_t passthru, svbfloat16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svtbxq, _bf16,,)(passthru, zn, zm); +} diff --git a/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_uzpq1.c b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_uzpq1.c new file mode 100644 index 0000000000000..c0fec3951ff58 --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_uzpq1.c @@ -0,0 +1,217 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %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) A1 +#else +#define SVE_ACLE_FUNC(A1, A2) A1##A2 +#endif + +// CHECK-LABEL: define dso_local @test_svuzpq1_u8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svuzpq1_u8u11__SVUint8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint8_t test_svuzpq1_u8(svuint8_t zn, svuint8_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_u8)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq1_u16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq1_u16u12__SVUint16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint16_t test_svuzpq1_u16(svuint16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_u16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq1_u32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq1_u32u12__SVUint32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint32_t test_svuzpq1_u32(svuint32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_u32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq1_u64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq1_u64u12__SVUint64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint64_t test_svuzpq1_u64(svuint64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_u64)(zn, zm); +} + + +// CHECK-LABEL: define dso_local @test_svuzpq1_s8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svuzpq1_s8u10__SVInt8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint8_t test_svuzpq1_s8(svint8_t zn, svint8_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_s8)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq1_s16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq1_s16u11__SVInt16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint16_t test_svuzpq1_s16(svint16_t zn, svint16_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_s16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq1_s32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq1_s32u11__SVInt32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint32_t test_svuzpq1_s32(svint32_t zn, svint32_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_s32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq1_s64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq1_s64u11__SVInt64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint64_t test_svuzpq1_s64(svint64_t zn, svint64_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_s64)(zn, zm); +} + + +// CHECK-LABEL: define dso_local @test_svuzpq1_f16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv8f16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq1_f16u13__SVFloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv8f16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat16_t test_svuzpq1_f16(svfloat16_t zn, svfloat16_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_f16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq1_f32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv4f32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq1_f32u13__SVFloat32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv4f32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat32_t test_svuzpq1_f32(svfloat32_t zn, svfloat32_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_f32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq1_f64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv2f64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq1_f64u13__SVFloat64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv2f64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat64_t test_svuzpq1_f64(svfloat64_t zn, svfloat64_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_f64)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq1_bf16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv8bf16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z17test_svuzpq1_bf16u14__SVBfloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq1.nxv8bf16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbfloat16_t test_svuzpq1_bf16(svbfloat16_t zn, svbfloat16_t zm) { + return SVE_ACLE_FUNC(svuzpq1,_bf16)(zn, zm); +} + + diff --git a/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_uzpq2.c b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_uzpq2.c new file mode 100644 index 0000000000000..0477ed2c6c28f --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_uzpq2.c @@ -0,0 +1,217 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %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) A1 +#else +#define SVE_ACLE_FUNC(A1, A2) A1##A2 +#endif + +// CHECK-LABEL: define dso_local @test_svuzpq2_u8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svuzpq2_u8u11__SVUint8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint8_t test_svuzpq2_u8(svuint8_t zn, svuint8_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_u8)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq2_u16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq2_u16u12__SVUint16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint16_t test_svuzpq2_u16(svuint16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_u16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq2_u32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq2_u32u12__SVUint32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint32_t test_svuzpq2_u32(svuint32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_u32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq2_u64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq2_u64u12__SVUint64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint64_t test_svuzpq2_u64(svuint64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_u64)(zn, zm); +} + + +// CHECK-LABEL: define dso_local @test_svuzpq2_s8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svuzpq2_s8u10__SVInt8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint8_t test_svuzpq2_s8(svint8_t zn, svint8_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_s8)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq2_s16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq2_s16u11__SVInt16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint16_t test_svuzpq2_s16(svint16_t zn, svint16_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_s16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq2_s32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq2_s32u11__SVInt32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint32_t test_svuzpq2_s32(svint32_t zn, svint32_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_s32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq2_s64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq2_s64u11__SVInt64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint64_t test_svuzpq2_s64(svint64_t zn, svint64_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_s64)(zn, zm); +} + + +// CHECK-LABEL: define dso_local @test_svuzpq2_f16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv8f16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq2_f16u13__SVFloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv8f16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat16_t test_svuzpq2_f16(svfloat16_t zn, svfloat16_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_f16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq2_f32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv4f32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq2_f32u13__SVFloat32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv4f32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat32_t test_svuzpq2_f32(svfloat32_t zn, svfloat32_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_f32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq2_f64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv2f64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svuzpq2_f64u13__SVFloat64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv2f64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat64_t test_svuzpq2_f64(svfloat64_t zn, svfloat64_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_f64)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svuzpq2_bf16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv8bf16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z17test_svuzpq2_bf16u14__SVBfloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.uzpq2.nxv8bf16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbfloat16_t test_svuzpq2_bf16(svbfloat16_t zn, svbfloat16_t zm) { + return SVE_ACLE_FUNC(svuzpq2,_bf16)(zn, zm); +} + + diff --git a/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_zipq1.c b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_zipq1.c new file mode 100644 index 0000000000000..06297651471ff --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_zipq1.c @@ -0,0 +1,217 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %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) A1 +#else +#define SVE_ACLE_FUNC(A1, A2) A1##A2 +#endif + +// CHECK-LABEL: define dso_local @test_svzipq1_u8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svzipq1_u8u11__SVUint8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint8_t test_svzipq1_u8(svuint8_t zn, svuint8_t zm) { + return SVE_ACLE_FUNC(svzipq1,_u8)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq1_u16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq1_u16u12__SVUint16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint16_t test_svzipq1_u16(svuint16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svzipq1,_u16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq1_u32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq1_u32u12__SVUint32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint32_t test_svzipq1_u32(svuint32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svzipq1,_u32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq1_u64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq1_u64u12__SVUint64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint64_t test_svzipq1_u64(svuint64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svzipq1,_u64)(zn, zm); +} + + +// CHECK-LABEL: define dso_local @test_svzipq1_s8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svzipq1_s8u10__SVInt8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint8_t test_svzipq1_s8(svint8_t zn, svint8_t zm) { + return SVE_ACLE_FUNC(svzipq1,_s8)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq1_s16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq1_s16u11__SVInt16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint16_t test_svzipq1_s16(svint16_t zn, svint16_t zm) { + return SVE_ACLE_FUNC(svzipq1,_s16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq1_s32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq1_s32u11__SVInt32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint32_t test_svzipq1_s32(svint32_t zn, svint32_t zm) { + return SVE_ACLE_FUNC(svzipq1,_s32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq1_s64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq1_s64u11__SVInt64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint64_t test_svzipq1_s64(svint64_t zn, svint64_t zm) { + return SVE_ACLE_FUNC(svzipq1,_s64)(zn, zm); +} + + +// CHECK-LABEL: define dso_local @test_svzipq1_f16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv8f16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq1_f16u13__SVFloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv8f16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat16_t test_svzipq1_f16(svfloat16_t zn, svfloat16_t zm) { + return SVE_ACLE_FUNC(svzipq1,_f16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq1_f32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv4f32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq1_f32u13__SVFloat32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv4f32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat32_t test_svzipq1_f32(svfloat32_t zn, svfloat32_t zm) { + return SVE_ACLE_FUNC(svzipq1,_f32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq1_f64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv2f64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq1_f64u13__SVFloat64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv2f64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat64_t test_svzipq1_f64(svfloat64_t zn, svfloat64_t zm) { + return SVE_ACLE_FUNC(svzipq1,_f64)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq1_bf16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv8bf16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z17test_svzipq1_bf16u14__SVBfloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq1.nxv8bf16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbfloat16_t test_svzipq1_bf16(svbfloat16_t zn, svbfloat16_t zm) { + return SVE_ACLE_FUNC(svzipq1,_bf16)(zn, zm); +} + + diff --git a/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_zipq2.c b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_zipq2.c new file mode 100644 index 0000000000000..04cb6c69de6c7 --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_zipq2.c @@ -0,0 +1,217 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -target-feature +bf16\ +// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %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) A1 +#else +#define SVE_ACLE_FUNC(A1, A2) A1##A2 +#endif + +// CHECK-LABEL: define dso_local @test_svzipq2_u8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svzipq2_u8u11__SVUint8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0:[0-9]+]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint8_t test_svzipq2_u8(svuint8_t zn, svuint8_t zm) { + return SVE_ACLE_FUNC(svzipq2,_u8)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq2_u16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq2_u16u12__SVUint16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint16_t test_svzipq2_u16(svuint16_t zn, svuint16_t zm) { + return SVE_ACLE_FUNC(svzipq2,_u16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq2_u32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq2_u32u12__SVUint32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint32_t test_svzipq2_u32(svuint32_t zn, svuint32_t zm) { + return SVE_ACLE_FUNC(svzipq2,_u32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq2_u64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq2_u64u12__SVUint64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svuint64_t test_svzipq2_u64(svuint64_t zn, svuint64_t zm) { + return SVE_ACLE_FUNC(svzipq2,_u64)(zn, zm); +} + + +// CHECK-LABEL: define dso_local @test_svzipq2_s8 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv16i8( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z15test_svzipq2_s8u10__SVInt8_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv16i8( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint8_t test_svzipq2_s8(svint8_t zn, svint8_t zm) { + return SVE_ACLE_FUNC(svzipq2,_s8)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq2_s16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv8i16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq2_s16u11__SVInt16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv8i16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint16_t test_svzipq2_s16(svint16_t zn, svint16_t zm) { + return SVE_ACLE_FUNC(svzipq2,_s16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq2_s32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv4i32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq2_s32u11__SVInt32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv4i32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint32_t test_svzipq2_s32(svint32_t zn, svint32_t zm) { + return SVE_ACLE_FUNC(svzipq2,_s32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq2_s64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv2i64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq2_s64u11__SVInt64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv2i64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svint64_t test_svzipq2_s64(svint64_t zn, svint64_t zm) { + return SVE_ACLE_FUNC(svzipq2,_s64)(zn, zm); +} + + +// CHECK-LABEL: define dso_local @test_svzipq2_f16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv8f16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq2_f16u13__SVFloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv8f16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat16_t test_svzipq2_f16(svfloat16_t zn, svfloat16_t zm) { + return SVE_ACLE_FUNC(svzipq2,_f16)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq2_f32 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv4f32( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq2_f32u13__SVFloat32_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv4f32( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat32_t test_svzipq2_f32(svfloat32_t zn, svfloat32_t zm) { + return SVE_ACLE_FUNC(svzipq2,_f32)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq2_f64 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv2f64( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z16test_svzipq2_f64u13__SVFloat64_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv2f64( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svfloat64_t test_svzipq2_f64(svfloat64_t zn, svfloat64_t zm) { + return SVE_ACLE_FUNC(svzipq2,_f64)(zn, zm); +} + +// CHECK-LABEL: define dso_local @test_svzipq2_bf16 +// CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv8bf16( [[ZN]], [[ZM]]) +// CHECK-NEXT: ret [[TMP0]] +// +// CPP-CHECK-LABEL: define dso_local @_Z17test_svzipq2_bf16u14__SVBfloat16_tS_ +// CPP-CHECK-SAME: ( [[ZN:%.*]], [[ZM:%.*]]) #[[ATTR0]] { +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call @llvm.aarch64.sve.zipq2.nxv8bf16( [[ZN]], [[ZM]]) +// CPP-CHECK-NEXT: ret [[TMP0]] +// +svbfloat16_t test_svzipq2_bf16(svbfloat16_t zn, svbfloat16_t zm) { + return SVE_ACLE_FUNC(svzipq2,_bf16)(zn, zm); +} + + diff --git a/clang/test/Sema/aarch64-sve2p1-intrinsics/acle_sve2p1_imm.cpp b/clang/test/Sema/aarch64-sve2p1-intrinsics/acle_sve2p1_imm.cpp index c4e087c8b7d79..84fdba432c244 100644 --- a/clang/test/Sema/aarch64-sve2p1-intrinsics/acle_sve2p1_imm.cpp +++ b/clang/test/Sema/aarch64-sve2p1-intrinsics/acle_sve2p1_imm.cpp @@ -116,3 +116,37 @@ void test_svdot_lane_2way(svint32_t s32, svuint32_t u32, svint16_t s16, svuint16 svdot_lane_u32_u16_u16(u32, u16, u16, 4); // expected-error {{argument value 4 is outside the valid range [0, 3]}} svdot_lane_f32_f16_f16(f32, f16, f16, 4); // expected-error {{argument value 4 is outside the valid range [0, 3]}} } + +__attribute__((target("+sve2p1"))) +void test_svextq_lane(svint16_t zn_i16, svint16_t zm_i16, svfloat16_t zn_f16, svfloat16_t zm_f16){ + svextq_lane_s16(zn_i16, zm_i16, -1); // expected-error {{argument value -1 is outside the valid range [0, 15]}} + svextq_lane_f16(zn_f16, zm_f16, 16); // expected-error {{argument value 16 is outside the valid range [0, 15]}} +} + +__attribute__((target("+sve2p1"))) +void test_svpmov_lane(){ + svuint8_t zn_u8; + svuint16_t zn_u16; + svuint32_t zn_u32; + svuint64_t zn_u64; + svbool_t pn; + + svpmov_lane_u8(zn_u8, -1); // expected-error {{argument value -1 is outside the valid range [0, 0]}} + svpmov_lane_u16(zn_u16, -1); // expected-error {{argument value -1 is outside the valid range [0, 1]}} + svpmov_lane_u32(zn_u32, -1); // expected-error {{argument value -1 is outside the valid range [0, 3]}} + svpmov_lane_u64(zn_u64, -1); // expected-error {{argument value -1 is outside the valid range [0, 7]}} + + svpmov_lane_u8(zn_u8, 1); // expected-error {{argument value 1 is outside the valid range [0, 0]}} + svpmov_lane_u16(zn_u16, 3); // expected-error {{argument value 3 is outside the valid range [0, 1]}} + svpmov_lane_u32(zn_u32, 5); // expected-error {{argument value 5 is outside the valid range [0, 3]}} + svpmov_lane_u64(zn_u64, 8); // expected-error {{argument value 8 is outside the valid range [0, 7]}} + + + zn_u16 = svpmov_lane_u16_m(zn_u16, pn, 0); // expected-error {{argument value 0 is outside the valid range [1, 1]}} + zn_u32 = svpmov_lane_u32_m(zn_u32, pn, 0); // expected-error {{argument value 0 is outside the valid range [1, 3]}} + zn_u64 = svpmov_lane_u64_m(zn_u64, pn, 0); // expected-error {{argument value 0 is outside the valid range [1, 7]}} + + zn_u16 = svpmov_lane_u16_m(zn_u16, pn, 3); // expected-error {{argument value 3 is outside the valid range [1, 1]}} + zn_u32 = svpmov_lane_u32_m(zn_u32, pn, 5); // expected-error {{argument value 5 is outside the valid range [1, 3]}} + zn_u64 = svpmov_lane_u64_m(zn_u64, pn, 8); // expected-error {{argument value 8 is outside the valid range [1, 7]}} +} diff --git a/llvm/include/llvm/IR/IntrinsicsAArch64.td b/llvm/include/llvm/IR/IntrinsicsAArch64.td index 1b701a91455c9..4815dde06afdc 100644 --- a/llvm/include/llvm/IR/IntrinsicsAArch64.td +++ b/llvm/include/llvm/IR/IntrinsicsAArch64.td @@ -3460,3 +3460,44 @@ let TargetPrefix = "aarch64" in { def int_aarch64_sme_str_zt : SME_LDR_STR_ZT_Intrinsic; } + +// SVE2.1 - ZIPQ1, ZIPQ2, UZPQ1, UZPQ2 +// +def int_aarch64_sve_zipq1 : AdvSIMD_2VectorArg_Intrinsic; +def int_aarch64_sve_zipq2 : AdvSIMD_2VectorArg_Intrinsic; +def int_aarch64_sve_uzpq1 : AdvSIMD_2VectorArg_Intrinsic; +def int_aarch64_sve_uzpq2 : AdvSIMD_2VectorArg_Intrinsic; + +// SVE2.1 - Programmable table lookup within each quadword vector segment +// (zeroing)/(merging) +// +def int_aarch64_sve_tblq : AdvSIMD_SVE_TBL_Intrinsic; +def int_aarch64_sve_tbxq : AdvSIMD_SVE2_TBX_Intrinsic; + +// SVE2.1 - Extract vector segment from each pair of quadword segments. +// +def int_aarch64_sve_extq_lane : AdvSIMD_2VectorArgIndexed_Intrinsic; + +// +// SVE2.1 - Move predicate to/from vector +// +def int_aarch64_sve_pmov_to_pred_lane : + DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>], + [llvm_anyvector_ty, llvm_i32_ty], + [IntrNoMem, ImmArg>]>; + +def int_aarch64_sve_pmov_to_pred_lane_zero : + DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>], + [llvm_anyvector_ty], + [IntrNoMem]>; + +def int_aarch64_sve_pmov_to_vector_lane_merging : + DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [LLVMMatchType<0>, + LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_i32_ty], + [IntrNoMem, ImmArg>]>; + +def int_aarch64_sve_pmov_to_vector_lane_zeroing : + DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>], + [IntrNoMem]>; diff --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td index f88f5a240a1fd..68e87f491a09e 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td +++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td @@ -818,8 +818,11 @@ def tvecshiftR64 : Operand, TImmLeaf; def Imm0_1Operand : AsmImmRange<0, 1>; +def Imm1_1Operand : AsmImmRange<1, 1>; def Imm0_3Operand : AsmImmRange<0, 3>; +def Imm1_3Operand : AsmImmRange<1, 3>; def Imm0_7Operand : AsmImmRange<0, 7>; +def Imm1_7Operand : AsmImmRange<1, 7>; def Imm0_15Operand : AsmImmRange<0, 15>; def Imm0_31Operand : AsmImmRange<0, 31>; def Imm0_63Operand : AsmImmRange<0, 63>; @@ -1035,6 +1038,13 @@ def timm0_1 : Operand, TImmLeaf, TImmLeaf { + let ParserMatchClass = Imm0_0Operand; +} + // timm32_0_1 predicate - True if the 32-bit immediate is in the range [0,1] def timm32_0_1 : Operand, TImmLeaf, TImmLeaf, TImmLeaf { + let ParserMatchClass = Imm1_1Operand; +} + +// timm32_1_3 predicate - True if the 32-bit immediate is in the range [1,3] +def timm32_1_3 : Operand, TImmLeaf 0 && ((uint32_t)Imm) < 4; +}]> { + let ParserMatchClass = Imm1_3Operand; +} + // imm0_15 predicate - True if the immediate is in the range [0,15] def imm0_15 : Operand, ImmLeaf, TImmLeaf, TImmLeaf 0 && ((uint32_t)Imm) < 8; +}]> { + let ParserMatchClass = Imm1_7Operand; +} + // imm32_0_15 predicate - True if the 32-bit immediate is in the range [0,15] def imm32_0_15 : Operand, ImmLeaf; + defm VectorIndex032b : VectorIndex; } } defm VectorIndex1 : VectorIndex; defm FMINQV : sve2p1_fp_reduction_q<0b111, "fminqv">; defm DUPQ_ZZI : sve2p1_dupq<"dupq">; -def EXTQ_ZZI : sve2p1_extq<"extq">; +defm EXTQ_ZZI : sve2p1_extq<"extq", int_aarch64_sve_extq_lane>; -defm PMOV_PZI : sve2p1_vector_to_pred<"pmov">; -defm PMOV_ZIP : sve2p1_pred_to_vector<"pmov">; +defm PMOV_PZI : sve2p1_vector_to_pred<"pmov", int_aarch64_sve_pmov_to_pred_lane, int_aarch64_sve_pmov_to_pred_lane_zero>; +defm PMOV_ZIP : sve2p1_pred_to_vector<"pmov", int_aarch64_sve_pmov_to_vector_lane_merging, int_aarch64_sve_pmov_to_vector_lane_zeroing>; defm ORQV_VPZ : sve2p1_int_reduce_q<0b1100, "orqv">; defm EORQV_VPZ : sve2p1_int_reduce_q<0b1101, "eorqv">; @@ -4008,12 +4008,12 @@ defm UMAXQV_VPZ : sve2p1_int_reduce_q<0b0101, "umaxqv">; defm SMINQV_VPZ : sve2p1_int_reduce_q<0b0110, "sminqv">; defm UMINQV_VPZ : sve2p1_int_reduce_q<0b0111, "uminqv">; -defm TBXQ_ZZZ : sve2_int_perm_tbx<"tbxq", 0b10, null_frag>; -defm ZIPQ1_ZZZ : sve2p1_permute_vec_elems_q<0b000, "zipq1">; -defm ZIPQ2_ZZZ : sve2p1_permute_vec_elems_q<0b001, "zipq2">; -defm UZPQ1_ZZZ : sve2p1_permute_vec_elems_q<0b010, "uzpq1">; -defm UZPQ2_ZZZ : sve2p1_permute_vec_elems_q<0b011, "uzpq2">; -defm TBLQ_ZZZ : sve2p1_tblq<"tblq">; +defm ZIPQ1_ZZZ : sve2p1_permute_vec_elems_q<0b000, "zipq1", int_aarch64_sve_zipq1>; +defm ZIPQ2_ZZZ : sve2p1_permute_vec_elems_q<0b001, "zipq2", int_aarch64_sve_zipq2>; +defm UZPQ1_ZZZ : sve2p1_permute_vec_elems_q<0b010, "uzpq1", int_aarch64_sve_uzpq1>; +defm UZPQ2_ZZZ : sve2p1_permute_vec_elems_q<0b011, "uzpq2", int_aarch64_sve_uzpq2>; +defm TBXQ_ZZZ : sve2_int_perm_tbx<"tbxq", 0b10, int_aarch64_sve_tbxq>; +defm TBLQ_ZZZ : sve2p1_tblq<"tblq", int_aarch64_sve_tblq>; } // End HasSVE2p1_or_HasSME2p1 //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td index d54be1e406fed..8dbfe098c7b5d 100644 --- a/llvm/lib/Target/AArch64/SVEInstrFormats.td +++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td @@ -9913,7 +9913,7 @@ multiclass sve2p1_dupq { // SVE Permute Vector - Quadwords (EXTQ) class sve2p1_extq - : I<(outs ZPR8:$Zdn), (ins ZPR8:$_Zdn, ZPR8:$Zm, imm0_15:$imm4), + : I<(outs ZPR8:$Zdn), (ins ZPR8:$_Zdn, ZPR8:$Zm, timm32_0_15:$imm4), mnemonic, "\t$Zdn, $_Zdn, $Zm, $imm4", "", []>, Sched<[]> { bits<5> Zdn; @@ -9931,6 +9931,19 @@ class sve2p1_extq let hasSideEffects = 0; } +multiclass sve2p1_extq { + def NAME : sve2p1_extq; + def : SVE_3_Op_Imm_Pat(NAME)>; + def : SVE_3_Op_Imm_Pat(NAME)>; + def : SVE_3_Op_Imm_Pat(NAME)>; + def : SVE_3_Op_Imm_Pat(NAME)>; + + def : SVE_3_Op_Imm_Pat(NAME)>; + def : SVE_3_Op_Imm_Pat(NAME)>; + def : SVE_3_Op_Imm_Pat(NAME)>; + def : SVE_3_Op_Imm_Pat(NAME +)>; +} // SVE move predicate from vector class sve2p1_vector_to_pred opc, string mnemonic, @@ -9952,8 +9965,8 @@ class sve2p1_vector_to_pred opc, string mnemonic, let hasSideEffects = 0; } -multiclass sve2p1_vector_to_pred { - def _B : sve2p1_vector_to_pred<{0, 0, 0, 1}, mnemonic, PPR8, VectorIndex0>; +multiclass sve2p1_vector_to_pred { + def _B : sve2p1_vector_to_pred<{0, 0, 0, 1}, mnemonic, PPR8, VectorIndex032b>; def _H : sve2p1_vector_to_pred<{0, 0, 1, ?}, mnemonic, PPR16, VectorIndexD32b> { bits<1> index; let Inst{17} = index; @@ -9970,6 +9983,25 @@ multiclass sve2p1_vector_to_pred { def : InstAlias(NAME # _B) PPR8:$Pd, ZPRAny:$Zn, 0), 1>; + + // any_lane + def : Pat<(nxv16i1 (Op_lane (nxv16i8 ZPRAny:$Zn), (i32 timm32_0_0:$Idx))), + (!cast(NAME # _B) ZPRAny:$Zn, timm32_0_0:$Idx)>; + def : Pat<(nxv8i1 (Op_lane (nxv8i16 ZPRAny:$Zn), (i32 timm32_0_1:$Idx))), + (!cast(NAME # _H) ZPRAny:$Zn, timm32_0_1:$Idx)>; + def : Pat<(nxv4i1 (Op_lane (nxv4i32 ZPRAny:$Zn), (i32 timm32_0_3:$Idx))), + (!cast(NAME # _S) ZPRAny:$Zn, timm32_0_3:$Idx)>; + def : Pat<(nxv2i1 (Op_lane (nxv2i64 ZPRAny:$Zn), (i32 timm32_0_7:$Idx))), + (!cast(NAME # _D) ZPRAny:$Zn, timm32_0_7:$Idx)>; + // lane_0 + def : Pat<(nxv16i1 (Op (nxv16i8 ZPRAny:$Zn))), + (!cast(NAME # _B) ZPRAny:$Zn, 0)>; + def : Pat<(nxv8i1 (Op (nxv8i16 ZPRAny:$Zn))), + (!cast(NAME # _H) ZPRAny:$Zn, 0)>; + def : Pat<(nxv4i1 (Op (nxv4i32 ZPRAny:$Zn))), + (!cast(NAME # _S) ZPRAny:$Zn, 0)>; + def : Pat<(nxv2i1 (Op (nxv2i64 ZPRAny:$Zn))), + (!cast(NAME # _D) ZPRAny:$Zn, 0)>; } @@ -9993,7 +10025,8 @@ class sve2p1_pred_to_vector opc, string mnemonic, let hasSideEffects = 0; } -multiclass sve2p1_pred_to_vector { +multiclass sve2p1_pred_to_vector { def _B : sve2p1_pred_to_vector<{0, 0, 0, 1}, mnemonic, PPR8, VectorIndex0>; def _H : sve2p1_pred_to_vector<{0, 0, 1, ?}, mnemonic, PPR16, VectorIndexD32b> { bits<1> index; @@ -10011,6 +10044,24 @@ multiclass sve2p1_pred_to_vector { def : InstAlias(NAME # _B) ZPRAny:$Zd, 0, PPR8:$Pn), 1>; + + // Merge + def : Pat<(nxv8i16 (MergeOp (nxv8i16 ZPRAny:$Zd), (nxv8i1 PPR16:$Pn), (i32 timm32_1_1:$Idx))), + (!cast(NAME # _H) ZPRAny:$Zd, timm32_1_1:$Idx, PPR16:$Pn)>; + def : Pat<(nxv4i32 (MergeOp (nxv4i32 ZPRAny:$Zd), (nxv4i1 PPR32:$Pn), (i32 timm32_1_3:$Idx))), + (!cast(NAME # _S) ZPRAny:$Zd, timm32_1_3:$Idx, PPR32:$Pn)>; + def : Pat<(nxv2i64 (MergeOp (nxv2i64 ZPRAny:$Zd), (nxv2i1 PPR64:$Pn), (i32 timm32_1_7:$Idx))), + (!cast(NAME # _D) ZPRAny:$Zd, timm32_1_7:$Idx, PPR64:$Pn)>; + + // Zero + def : Pat<(nxv16i8 (ZeroOp (nxv16i1 PPR8:$Pn))), + (!cast(NAME # _B) (IMPLICIT_DEF), 0, PPR8:$Pn)>; + def : Pat<(nxv8i16 (ZeroOp (nxv8i1 PPR16:$Pn))), + (!cast(NAME # _H) (IMPLICIT_DEF), 0, PPR16:$Pn)>; + def : Pat<(nxv4i32 (ZeroOp (nxv4i1 PPR32:$Pn))), + (!cast(NAME # _S) (IMPLICIT_DEF), 0, PPR32:$Pn)>; + def : Pat<(nxv2i64 (ZeroOp (nxv2i1 PPR64:$Pn))), + (!cast(NAME # _D) (IMPLICIT_DEF), 0, PPR64:$Pn)>; } @@ -10066,18 +10117,41 @@ class sve2p1_permute_vec_elems_q sz, bits<3> opc, string mnemonic, let hasSideEffects = 0; } -multiclass sve2p1_permute_vec_elems_q opc, string mnemonic> { +multiclass sve2p1_permute_vec_elems_q opc, string mnemonic, + SDPatternOperator op> { def _B : sve2p1_permute_vec_elems_q<0b00, opc, mnemonic, ZPR8, ZPR8>; def _H : sve2p1_permute_vec_elems_q<0b01, opc, mnemonic, ZPR16, ZPR16>; def _S : sve2p1_permute_vec_elems_q<0b10, opc, mnemonic, ZPR32, ZPR32>; def _D : sve2p1_permute_vec_elems_q<0b11, opc, mnemonic, ZPR64, ZPR64>; + + def : SVE_2_Op_Pat(NAME # _B)>; + def : SVE_2_Op_Pat(NAME # _H)>; + def : SVE_2_Op_Pat(NAME # _S)>; + def : SVE_2_Op_Pat(NAME # _D)>; + + def : SVE_2_Op_Pat(NAME # _H)>; + def : SVE_2_Op_Pat(NAME # _S)>; + def : SVE_2_Op_Pat(NAME # _D)>; + + def : SVE_2_Op_Pat(NAME # _H)>; } -multiclass sve2p1_tblq { +multiclass sve2p1_tblq { def _B : sve2p1_permute_vec_elems_q<0b00, 0b110, mnemonic, ZPR8, Z_b>; def _H : sve2p1_permute_vec_elems_q<0b01, 0b110, mnemonic, ZPR16, Z_h>; def _S : sve2p1_permute_vec_elems_q<0b10, 0b110, mnemonic, ZPR32, Z_s>; def _D : sve2p1_permute_vec_elems_q<0b11, 0b110, mnemonic, ZPR64, Z_d>; + + def : SVE_2_Op_Pat(NAME # _B)>; + def : SVE_2_Op_Pat(NAME # _H)>; + def : SVE_2_Op_Pat(NAME # _S)>; + def : SVE_2_Op_Pat(NAME # _D)>; + + def : SVE_2_Op_Pat(NAME # _H)>; + def : SVE_2_Op_Pat(NAME # _S)>; + def : SVE_2_Op_Pat(NAME # _D)>; + + def : SVE_2_Op_Pat(NAME # _H)>; } //===----------------------------------------------------------------------===// diff --git a/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-extq.ll b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-extq.ll new file mode 100644 index 0000000000000..efe19432f9c32 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-extq.ll @@ -0,0 +1,83 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve2p1,+bf16 < %s | FileCheck %s + +define @test_extq_i8 ( %zn, %zm) { +; CHECK-LABEL: test_extq_i8: +; CHECK: // %bb.0: +; CHECK-NEXT: extq z0.b, z0.b, z1.b, #0 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.extq.lane.nxv16i8( %zn, %zm, i32 0) + ret %res +} + +define @test_extq_i16 ( %zn, %zm) { +; CHECK-LABEL: test_extq_i16: +; CHECK: // %bb.0: +; CHECK-NEXT: extq z0.b, z0.b, z1.b, #1 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.extq.lane.nxv8i16( %zn, %zm, i32 1) + ret %res +} + +define @test_extq_i32 ( %zn, %zm) { +; CHECK-LABEL: test_extq_i32: +; CHECK: // %bb.0: +; CHECK-NEXT: extq z0.b, z0.b, z1.b, #2 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.extq.lane.nxv4i32( %zn, %zm, i32 2) + ret %res +} + +define @test_extq_i64 ( %zn, %zm) { +; CHECK-LABEL: test_extq_i64: +; CHECK: // %bb.0: +; CHECK-NEXT: extq z0.b, z0.b, z1.b, #3 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.extq.lane.nxv2i64( %zn, %zm, i32 3) + ret %res +} + +define @test_extq_f16( %zn, %zm) { +; CHECK-LABEL: test_extq_f16: +; CHECK: // %bb.0: +; CHECK-NEXT: extq z0.b, z0.b, z1.b, #4 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.extq.lane.nxv8f16( %zn, %zm, i32 4) + ret %res +} + +define @test_extq_f32( %zn, %zm) { +; CHECK-LABEL: test_extq_f32: +; CHECK: // %bb.0: +; CHECK-NEXT: extq z0.b, z0.b, z1.b, #5 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.extq.lane.nxv4f32( %zn, %zm, i32 5) + ret %res +} + +define @test_extq_f64( %zn, %zm) { +; CHECK-LABEL: test_extq_f64: +; CHECK: // %bb.0: +; CHECK-NEXT: extq z0.b, z0.b, z1.b, #6 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.extq.lane.nxv2f64( %zn, %zm, i32 6) + ret %res +} + +define @test_extq_bf16( %zn, %zm) { +; CHECK-LABEL: test_extq_bf16: +; CHECK: // %bb.0: +; CHECK-NEXT: extq z0.b, z0.b, z1.b, #15 +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.extq.lane.nxv8bf16( %zn, %zm, i32 15) + ret %res +} + +declare @llvm.aarch64.sve.extq.lane.nxv16i8(, , i32) +declare @llvm.aarch64.sve.extq.lane.nxv8i16(, , i32) +declare @llvm.aarch64.sve.extq.lane.nxv4i32(, , i32) +declare @llvm.aarch64.sve.extq.lane.nxv2i64(, , i32) +declare @llvm.aarch64.sve.extq.lane.nxv8f16(, , i32) +declare @llvm.aarch64.sve.extq.lane.nxv4f32(, , i32) +declare @llvm.aarch64.sve.extq.lane.nxv2f64(, , i32) +declare @llvm.aarch64.sve.extq.lane.nxv8bf16(, , i32) diff --git a/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-pmov-to-pred.ll b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-pmov-to-pred.ll new file mode 100644 index 0000000000000..7cae1d2c216b6 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-pmov-to-pred.ll @@ -0,0 +1,121 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2p1 < %s | FileCheck %s + +define @test_pmov_to_pred_i8( %zn) { +; CHECK-LABEL: test_pmov_to_pred_i8: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.pred.lane.nxv16i8 +; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res = call @llvm.aarch64.sve.pmov.to.pred.lane.nxv16i8( %zn, i32 0) + ret %res +} + +define @test_pmov_to_pred_i16( %zn) { +; CHECK-LABEL: test_pmov_to_pred_i16: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-NEXT: addvl sp, sp, #-2 +; CHECK-NEXT: str p4, [sp, #7, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str z8, [sp, #1, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 16 * VG +; CHECK-NEXT: .cfi_offset w30, -8 +; CHECK-NEXT: .cfi_offset w29, -16 +; CHECK-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 16 - 8 * VG +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: mov z8.d, z0.d +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.pred.lane.nxv8i16 +; CHECK-NEXT: mov z0.d, z8.d +; CHECK-NEXT: mov w0, #1 // =0x1 +; CHECK-NEXT: mov p4.b, p0.b +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.pred.lane.nxv8i16 +; CHECK-NEXT: ptrue p1.h +; CHECK-NEXT: ldr z8, [sp, #1, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: eor p0.b, p1/z, p4.b, p0.b +; CHECK-NEXT: ldr p4, [sp, #7, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: addvl sp, sp, #2 +; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res1 = call @llvm.aarch64.sve.pmov.to.pred.lane.nxv8i16( %zn, i32 0) + %res2 = call @llvm.aarch64.sve.pmov.to.pred.lane.nxv8i16( %zn, i32 1) + + %res = add %res1, %res2 + ret %res +} + +define @test_pmov_to_pred_i32( %zn) { +; CHECK-LABEL: test_pmov_to_pred_i32: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-NEXT: addvl sp, sp, #-2 +; CHECK-NEXT: str p4, [sp, #7, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str z8, [sp, #1, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 16 * VG +; CHECK-NEXT: .cfi_offset w30, -8 +; CHECK-NEXT: .cfi_offset w29, -16 +; CHECK-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 16 - 8 * VG +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: mov z8.d, z0.d +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.pred.lane.nxv4i32 +; CHECK-NEXT: mov z0.d, z8.d +; CHECK-NEXT: mov w0, #3 // =0x3 +; CHECK-NEXT: mov p4.b, p0.b +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.pred.lane.nxv4i32 +; CHECK-NEXT: ptrue p1.s +; CHECK-NEXT: ldr z8, [sp, #1, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: eor p0.b, p1/z, p4.b, p0.b +; CHECK-NEXT: ldr p4, [sp, #7, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: addvl sp, sp, #2 +; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res1 = call @llvm.aarch64.sve.pmov.to.pred.lane.nxv4i32( %zn, i32 0) + %res2 = call @llvm.aarch64.sve.pmov.to.pred.lane.nxv4i32( %zn, i32 3) + + %res = add %res1, %res2 + ret %res +} + +define @test_pmov_to_pred_i64( %zn) { +; CHECK-LABEL: test_pmov_to_pred_i64: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-NEXT: addvl sp, sp, #-2 +; CHECK-NEXT: str p4, [sp, #7, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str z8, [sp, #1, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 16 * VG +; CHECK-NEXT: .cfi_offset w30, -8 +; CHECK-NEXT: .cfi_offset w29, -16 +; CHECK-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 16 - 8 * VG +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: mov z8.d, z0.d +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.pred.lane.nxv2i64 +; CHECK-NEXT: mov z0.d, z8.d +; CHECK-NEXT: mov w0, #7 // =0x7 +; CHECK-NEXT: mov p4.b, p0.b +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.pred.lane.nxv2i64 +; CHECK-NEXT: ptrue p1.d +; CHECK-NEXT: ldr z8, [sp, #1, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: eor p0.b, p1/z, p4.b, p0.b +; CHECK-NEXT: ldr p4, [sp, #7, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: addvl sp, sp, #2 +; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res1 = call @llvm.aarch64.sve.pmov.to.pred.lane.nxv2i64( %zn, i32 0) + %res2 = call @llvm.aarch64.sve.pmov.to.pred.lane.nxv2i64( %zn, i32 7) + + %res = add %res1, %res2 + ret %res +} + +declare @llvm.aarch64.sve.pmov.to.pred.lane.nxv16i8(, i32) +declare @llvm.aarch64.sve.pmov.to.pred.lane.nxv8i16(, i32) +declare @llvm.aarch64.sve.pmov.to.pred.lane.nxv4i32(, i32) +declare @llvm.aarch64.sve.pmov.to.pred.lane.nxv2i64(, i32) diff --git a/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-pmov-to-vector.ll b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-pmov-to-vector.ll new file mode 100644 index 0000000000000..58b240b0fbd68 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-pmov-to-vector.ll @@ -0,0 +1,117 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2p1 < %s | FileCheck %s + +; Merge + +define @test_pmov_to_vector_i16( %zn, %pn) { +; CHECK-LABEL: test_pmov_to_vector_i16: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: mov w0, #1 // =0x1 +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv8i16 +; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res = call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv8i16( %zn, %pn, i32 1) + ret %res +} + +define @test_pmov_to_vector_i32( %zn, %pn) { +; CHECK-LABEL: test_pmov_to_vector_i32: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: mov w0, #3 // =0x3 +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv4i32 +; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res = call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv4i32( %zn, %pn, i32 3) + ret %res +} + +define @test_pmov_to_vector_i64( %zn, %pn) { +; CHECK-LABEL: test_pmov_to_vector_i64: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: mov w0, #7 // =0x7 +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv2i64 +; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res = call @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv2i64( %zn, %pn, i32 7) + ret %res +} + + +; Zero + +define @test_pmov_to_vector_zero_i8( %pn) { +; CHECK-LABEL: test_pmov_to_vector_zero_i8: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv16i8 +; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res = call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv16i8( %pn) + ret %res +} + +define @test_pmov_to_vector_zero_i16( %pn) { +; CHECK-LABEL: test_pmov_to_vector_zero_i16: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv8i16 +; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res = call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv8i16( %pn) + ret %res +} + +define @test_pmov_to_vector_zero_i32( %pn) { +; CHECK-LABEL: test_pmov_to_vector_zero_i32: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv4i32 +; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res = call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv4i32( %pn) + ret %res +} + +define @test_pmov_to_vector_zero_i64( %pn) { +; CHECK-LABEL: test_pmov_to_vector_zero_i64: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: bl llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv2i64 +; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: ret + entry: + %res = call @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv2i64( %pn) + ret %res +} + +declare @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv8i16(, , i32) +declare @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv4i32(, , i32) +declare @llvm.aarch64.sve.pmov.to.vector.lane.merging.nxv2i64(, , i32) + +declare @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv16i8() +declare @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv8i16() +declare @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv4i32() +declare @llvm.aarch64.sve.pmov.to.vector.lane.zeroing.nxv2i64() diff --git a/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-tblq.ll b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-tblq.ll new file mode 100644 index 0000000000000..cc9bbcfe47102 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-tblq.ll @@ -0,0 +1,83 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve2p1,+bf16 < %s | FileCheck %s + +define @test_tblq_i8 ( %zn, %zm) { +; CHECK-LABEL: test_tblq_i8: +; CHECK: // %bb.0: +; CHECK-NEXT: tblq z0.b, { z0.b }, z1.b +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tblq.nxv16i8( %zn, %zm) + ret %res +} + +define @test_tblq_i16 ( %zn, %zm) { +; CHECK-LABEL: test_tblq_i16: +; CHECK: // %bb.0: +; CHECK-NEXT: tblq z0.h, { z0.h }, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tblq.nxv8i16( %zn, %zm) + ret %res +} + +define @test_tblq_i32 ( %zn, %zm) { +; CHECK-LABEL: test_tblq_i32: +; CHECK: // %bb.0: +; CHECK-NEXT: tblq z0.s, { z0.s }, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tblq.nxv4i32( %zn, %zm) + ret %res +} + +define @test_tblq_i64 ( %zn, %zm) { +; CHECK-LABEL: test_tblq_i64: +; CHECK: // %bb.0: +; CHECK-NEXT: tblq z0.d, { z0.d }, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tblq.nxv2i64( %zn, %zm) + ret %res +} + +define @test_tblq_f16( %zn, %zm) { +; CHECK-LABEL: test_tblq_f16: +; CHECK: // %bb.0: +; CHECK-NEXT: tblq z0.h, { z0.h }, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tblq.nxv8f16( %zn, %zm) + ret %res +} + +define @test_tblq_f32( %zn, %zm) { +; CHECK-LABEL: test_tblq_f32: +; CHECK: // %bb.0: +; CHECK-NEXT: tblq z0.s, { z0.s }, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tblq.nxv4f32( %zn, %zm) + ret %res +} + +define @test_tblq_f64( %zn, %zm) { +; CHECK-LABEL: test_tblq_f64: +; CHECK: // %bb.0: +; CHECK-NEXT: tblq z0.d, { z0.d }, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tblq.nxv2f64( %zn, %zm) + ret %res +} + +define @test_tblq_bf16( %zn, %zm) { +; CHECK-LABEL: test_tblq_bf16: +; CHECK: // %bb.0: +; CHECK-NEXT: tblq z0.h, { z0.h }, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tblq.nxv8bf16( %zn, %zm) + ret %res +} + +declare @llvm.aarch64.sve.tblq.nxv16i8(, ) +declare @llvm.aarch64.sve.tblq.nxv8i16(, ) +declare @llvm.aarch64.sve.tblq.nxv4i32(, ) +declare @llvm.aarch64.sve.tblq.nxv2i64(, ) +declare @llvm.aarch64.sve.tblq.nxv8f16(, ) +declare @llvm.aarch64.sve.tblq.nxv4f32(, ) +declare @llvm.aarch64.sve.tblq.nxv2f64(, ) +declare @llvm.aarch64.sve.tblq.nxv8bf16(, ) diff --git a/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-tbxq.ll b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-tbxq.ll new file mode 100644 index 0000000000000..29265b5d02e51 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-tbxq.ll @@ -0,0 +1,83 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve2p1,+bf16 < %s | FileCheck %s + +define @test_tbxq_i8 ( %passthru, %zn, %zm) { +; CHECK-LABEL: test_tbxq_i8: +; CHECK: // %bb.0: +; CHECK-NEXT: tbxq z0.b, z1.b, z2.b +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tbxq.nxv16i8( %passthru, %zn, %zm) + ret %res +} + +define @test_tbxq_i16 ( %passthru, %zn, %zm) { +; CHECK-LABEL: test_tbxq_i16: +; CHECK: // %bb.0: +; CHECK-NEXT: tbxq z0.h, z1.h, z2.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tbxq.nxv8i16( %passthru, %zn, %zm) + ret %res +} + +define @test_tbxq_i32 ( %passthru, %zn, %zm) { +; CHECK-LABEL: test_tbxq_i32: +; CHECK: // %bb.0: +; CHECK-NEXT: tbxq z0.s, z1.s, z2.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tbxq.nxv4i32( %passthru, %zn, %zm) + ret %res +} + +define @test_tbxq_i64 ( %passthru, %zn, %zm) { +; CHECK-LABEL: test_tbxq_i64: +; CHECK: // %bb.0: +; CHECK-NEXT: tbxq z0.d, z1.d, z2.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tbxq.nxv2i64( %passthru, %zn, %zm) + ret %res +} + +define @test_tblq_f16( %passthru, %zn, %zm) { +; CHECK-LABEL: test_tblq_f16: +; CHECK: // %bb.0: +; CHECK-NEXT: tbxq z0.h, z1.h, z2.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tbxq.nxv8f16( %passthru, %zn, %zm) + ret %res +} + +define @test_tbxq_f32( %passthru, %zn, %zm) { +; CHECK-LABEL: test_tbxq_f32: +; CHECK: // %bb.0: +; CHECK-NEXT: tbxq z0.s, z1.s, z2.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tbxq.nxv4f32( %passthru, %zn, %zm) + ret %res +} + +define @test_tbxq_f64( %passthru, %zn, %zm) { +; CHECK-LABEL: test_tbxq_f64: +; CHECK: // %bb.0: +; CHECK-NEXT: tbxq z0.d, z1.d, z2.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tbxq.nxv2f64( %passthru, %zn, %zm) + ret %res +} + +define @test_tbxq_bf16( %passthru, %zn, %zm) { +; CHECK-LABEL: test_tbxq_bf16: +; CHECK: // %bb.0: +; CHECK-NEXT: tbxq z0.h, z1.h, z2.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.tbxq.nxv8bf16( %passthru, %zn, %zm) + ret %res +} + +declare @llvm.aarch64.sve.tbxq.nxv16i8(, , ) +declare @llvm.aarch64.sve.tbxq.nxv8i16(, , ) +declare @llvm.aarch64.sve.tbxq.nxv4i32(, , ) +declare @llvm.aarch64.sve.tbxq.nxv2i64(, , ) +declare @llvm.aarch64.sve.tbxq.nxv8f16(, , ) +declare @llvm.aarch64.sve.tbxq.nxv4f32(, , ) +declare @llvm.aarch64.sve.tbxq.nxv2f64(, , ) +declare @llvm.aarch64.sve.tbxq.nxv8bf16(, , ) diff --git a/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-uzpq1.ll b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-uzpq1.ll new file mode 100644 index 0000000000000..7a83b15008462 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-uzpq1.ll @@ -0,0 +1,85 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2p1,+bf16 < %s | FileCheck %s + +define @test_uzpq1_i8( %zn, %zm) { +; CHECK-LABEL: test_uzpq1_i8: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq1 z0.b, z0.b, z1.b +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq1.nxv16i8( %zn, %zm) + ret %res +} + +define @test_uzpq1_i16( %zn, %zm) { +; CHECK-LABEL: test_uzpq1_i16: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq1 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq1.nxv8i16( %zn, %zm) + ret %res +} + +define @test_uzpq1_i32( %zn, %zm) { +; CHECK-LABEL: test_uzpq1_i32: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq1 z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq1.nxv4i32( %zn, %zm) + ret %res +} + +define @test_uzpq1_i64( %zn, %zm) { +; CHECK-LABEL: test_uzpq1_i64: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq1 z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq1.nxv2i64( %zn, %zm) + ret %res +} + +define @test_uzpq1_f16( %zn, %zm) { +; CHECK-LABEL: test_uzpq1_f16: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq1 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq1.nxv8f16( %zn, %zm) + ret %res +} + +define @test_uzpq1_f32( %zn, %zm) { +; CHECK-LABEL: test_uzpq1_f32: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq1 z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq1.nxv4f32( %zn, %zm) + ret %res +} + +define @test_uzpq1_f64( %zn, %zm) { +; CHECK-LABEL: test_uzpq1_f64: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq1 z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq1.nxv2f64( %zn, %zm) + ret %res +} + +define @test_uzpq1_bf16( %zn, %zm) { +; CHECK-LABEL: test_uzpq1_bf16: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq1 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq1.nxv8bf16( %zn, %zm) + ret %res +} + + +declare @llvm.aarch64.sve.uzpq1.nxv16i8(, ) +declare @llvm.aarch64.sve.uzpq1.nxv8i16(, ) +declare @llvm.aarch64.sve.uzpq1.nxv4i32(, ) +declare @llvm.aarch64.sve.uzpq1.nxv2i64(, ) + +declare @llvm.aarch64.sve.uzpq1.nxv8f16(, ) +declare @llvm.aarch64.sve.uzpq1.nxv4f32(, ) +declare @llvm.aarch64.sve.uzpq1.nxv2f64(, ) +declare @llvm.aarch64.sve.uzpq1.nxv8bf16(, ) diff --git a/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-uzpq2.ll b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-uzpq2.ll new file mode 100644 index 0000000000000..8695f1c3e1ce9 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-uzpq2.ll @@ -0,0 +1,85 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2p1,+bf16 < %s | FileCheck %s + +define @test_uzpq2_i8( %zn, %zm) { +; CHECK-LABEL: test_uzpq2_i8: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq2 z0.b, z0.b, z1.b +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq2.nxv16i8( %zn, %zm) + ret %res +} + +define @test_uzpq2_i16( %zn, %zm) { +; CHECK-LABEL: test_uzpq2_i16: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq2 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq2.nxv8i16( %zn, %zm) + ret %res +} + +define @test_uzpq2_i32( %zn, %zm) { +; CHECK-LABEL: test_uzpq2_i32: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq2 z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq2.nxv4i32( %zn, %zm) + ret %res +} + +define @test_uzpq2_i64( %zn, %zm) { +; CHECK-LABEL: test_uzpq2_i64: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq2 z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq2.nxv2i64( %zn, %zm) + ret %res +} + +define @test_uzpq2_f16( %zn, %zm) { +; CHECK-LABEL: test_uzpq2_f16: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq2 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq2.nxv8f16( %zn, %zm) + ret %res +} + +define @test_uzpq2_f32( %zn, %zm) { +; CHECK-LABEL: test_uzpq2_f32: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq2 z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq2.nxv4f32( %zn, %zm) + ret %res +} + +define @test_uzpq2_f64( %zn, %zm) { +; CHECK-LABEL: test_uzpq2_f64: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq2 z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq2.nxv2f64( %zn, %zm) + ret %res +} + +define @test_uzpq2_bf16( %zn, %zm) { +; CHECK-LABEL: test_uzpq2_bf16: +; CHECK: // %bb.0: +; CHECK-NEXT: uzpq2 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.uzpq2.nxv8bf16( %zn, %zm) + ret %res +} + + +declare @llvm.aarch64.sve.uzpq2.nxv16i8(, ) +declare @llvm.aarch64.sve.uzpq2.nxv8i16(, ) +declare @llvm.aarch64.sve.uzpq2.nxv4i32(, ) +declare @llvm.aarch64.sve.uzpq2.nxv2i64(, ) + +declare @llvm.aarch64.sve.uzpq2.nxv8f16(, ) +declare @llvm.aarch64.sve.uzpq2.nxv4f32(, ) +declare @llvm.aarch64.sve.uzpq2.nxv2f64(, ) +declare @llvm.aarch64.sve.uzpq2.nxv8bf16(, ) diff --git a/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-zipq1.ll b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-zipq1.ll new file mode 100644 index 0000000000000..89383c1a3f230 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-zipq1.ll @@ -0,0 +1,85 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2p1,+bf16 < %s | FileCheck %s + +define @test_zipq1_i8( %zn, %zm) { +; CHECK-LABEL: test_zipq1_i8: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq1 z0.b, z0.b, z1.b +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq1.nxv16i8( %zn, %zm) + ret %res +} + +define @test_zipq1_i16( %zn, %zm) { +; CHECK-LABEL: test_zipq1_i16: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq1 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq1.nxv8i16( %zn, %zm) + ret %res +} + +define @test_zipq1_i32( %zn, %zm) { +; CHECK-LABEL: test_zipq1_i32: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq1 z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq1.nxv4i32( %zn, %zm) + ret %res +} + +define @test_zipq1_i64( %zn, %zm) { +; CHECK-LABEL: test_zipq1_i64: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq1 z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq1.nxv2i64( %zn, %zm) + ret %res +} + +define @test_zipq1_f16( %zn, %zm) { +; CHECK-LABEL: test_zipq1_f16: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq1 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq1.nxv8f16( %zn, %zm) + ret %res +} + +define @test_zipq1_f32( %zn, %zm) { +; CHECK-LABEL: test_zipq1_f32: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq1 z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq1.nxv4f32( %zn, %zm) + ret %res +} + +define @test_zipq1_f64( %zn, %zm) { +; CHECK-LABEL: test_zipq1_f64: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq1 z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq1.nxv2f64( %zn, %zm) + ret %res +} + +define @test_zipq1_bf16( %zn, %zm) { +; CHECK-LABEL: test_zipq1_bf16: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq1 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq1.nxv8bf16( %zn, %zm) + ret %res +} + + +declare @llvm.aarch64.sve.zipq1.nxv16i8(, ) +declare @llvm.aarch64.sve.zipq1.nxv8i16(, ) +declare @llvm.aarch64.sve.zipq1.nxv4i32(, ) +declare @llvm.aarch64.sve.zipq1.nxv2i64(, ) + +declare @llvm.aarch64.sve.zipq1.nxv8f16(, ) +declare @llvm.aarch64.sve.zipq1.nxv4f32(, ) +declare @llvm.aarch64.sve.zipq1.nxv2f64(, ) +declare @llvm.aarch64.sve.zipq1.nxv8bf16(, ) diff --git a/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-zipq2.ll b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-zipq2.ll new file mode 100644 index 0000000000000..c9aaae3371e80 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve2p1-intrinsics-zipq2.ll @@ -0,0 +1,85 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2p1,+bf16 < %s | FileCheck %s + +define @test_zipq2_i8( %zn, %zm) { +; CHECK-LABEL: test_zipq2_i8: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq2 z0.b, z0.b, z1.b +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq2.nxv16i8( %zn, %zm) + ret %res +} + +define @test_zipq2_i16( %zn, %zm) { +; CHECK-LABEL: test_zipq2_i16: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq2 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq2.nxv8i16( %zn, %zm) + ret %res +} + +define @test_zipq2_i32( %zn, %zm) { +; CHECK-LABEL: test_zipq2_i32: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq2 z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq2.nxv4i32( %zn, %zm) + ret %res +} + +define @test_zipq2_i64( %zn, %zm) { +; CHECK-LABEL: test_zipq2_i64: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq2 z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq2.nxv2i64( %zn, %zm) + ret %res +} + +define @test_zipq2_f16( %zn, %zm) { +; CHECK-LABEL: test_zipq2_f16: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq2 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq2.nxv8f16( %zn, %zm) + ret %res +} + +define @test_zipq2_f32( %zn, %zm) { +; CHECK-LABEL: test_zipq2_f32: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq2 z0.s, z0.s, z1.s +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq2.nxv4f32( %zn, %zm) + ret %res +} + +define @test_zipq2_f64( %zn, %zm) { +; CHECK-LABEL: test_zipq2_f64: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq2 z0.d, z0.d, z1.d +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq2.nxv2f64( %zn, %zm) + ret %res +} + +define @test_zipq2_bf16( %zn, %zm) { +; CHECK-LABEL: test_zipq2_bf16: +; CHECK: // %bb.0: +; CHECK-NEXT: zipq2 z0.h, z0.h, z1.h +; CHECK-NEXT: ret + %res = call @llvm.aarch64.sve.zipq2.nxv8bf16( %zn, %zm) + ret %res +} + + +declare @llvm.aarch64.sve.zipq2.nxv16i8(, ) +declare @llvm.aarch64.sve.zipq2.nxv8i16(, ) +declare @llvm.aarch64.sve.zipq2.nxv4i32(, ) +declare @llvm.aarch64.sve.zipq2.nxv2i64(, ) + +declare @llvm.aarch64.sve.zipq2.nxv8f16(, ) +declare @llvm.aarch64.sve.zipq2.nxv4f32(, ) +declare @llvm.aarch64.sve.zipq2.nxv2f64(, ) +declare @llvm.aarch64.sve.zipq2.nxv8bf16(, )