97 changes: 97 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_bext.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_BITPERM -triple aarch64-none-linux-gnu -target-feature +sve2-bitperm -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_BITPERM -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2-bitperm -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svuint8_t test_svbext_u8(svuint8_t op1, svuint8_t op2)
{
// CHECK-LABEL: test_svbext_u8
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.bext.x.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
// CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbext'}}
// expected-warning@+1 {{implicit declaration of function 'svbext_u8'}}
return SVE_ACLE_FUNC(svbext,_u8,,)(op1, op2);
}

svuint16_t test_svbext_u16(svuint16_t op1, svuint16_t op2)
{
// CHECK-LABEL: test_svbext_u16
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.bext.x.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
// CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbext'}}
// expected-warning@+1 {{implicit declaration of function 'svbext_u16'}}
return SVE_ACLE_FUNC(svbext,_u16,,)(op1, op2);
}

svuint32_t test_svbext_u32(svuint32_t op1, svuint32_t op2)
{
// CHECK-LABEL: test_svbext_u32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.bext.x.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbext'}}
// expected-warning@+1 {{implicit declaration of function 'svbext_u32'}}
return SVE_ACLE_FUNC(svbext,_u32,,)(op1, op2);
}

svuint64_t test_svbext_u64(svuint64_t op1, svuint64_t op2)
{
// CHECK-LABEL: test_svbext_u64
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.bext.x.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbext'}}
// expected-warning@+1 {{implicit declaration of function 'svbext_u64'}}
return SVE_ACLE_FUNC(svbext,_u64,,)(op1, op2);
}

svuint8_t test_svbext_n_u8(svuint8_t op1, uint8_t op2)
{
// CHECK-LABEL: test_svbext_n_u8
// CHECK: %[[DUP:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.bext.x.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %[[DUP]])
// CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbext'}}
// expected-warning@+1 {{implicit declaration of function 'svbext_n_u8'}}
return SVE_ACLE_FUNC(svbext,_n_u8,,)(op1, op2);
}

svuint16_t test_svbext_n_u16(svuint16_t op1, uint16_t op2)
{
// CHECK-LABEL: test_svbext_n_u16
// CHECK: %[[DUP:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.dup.x.nxv8i16(i16 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.bext.x.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %[[DUP]])
// CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbext'}}
// expected-warning@+1 {{implicit declaration of function 'svbext_n_u16'}}
return SVE_ACLE_FUNC(svbext,_n_u16,,)(op1, op2);
}

svuint32_t test_svbext_n_u32(svuint32_t op1, uint32_t op2)
{
// CHECK-LABEL: test_svbext_n_u32
// CHECK: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.bext.x.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %[[DUP]])
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbext'}}
// expected-warning@+1 {{implicit declaration of function 'svbext_n_u32'}}
return SVE_ACLE_FUNC(svbext,_n_u32,,)(op1, op2);
}

svuint64_t test_svbext_n_u64(svuint64_t op1, uint64_t op2)
{
// CHECK-LABEL: test_svbext_n_u64
// CHECK: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.bext.x.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %[[DUP]])
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbext'}}
// expected-warning@+1 {{implicit declaration of function 'svbext_n_u64'}}
return SVE_ACLE_FUNC(svbext,_n_u64,,)(op1, op2);
}
97 changes: 97 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_bgrp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_BITPERM -triple aarch64-none-linux-gnu -target-feature +sve2-bitperm -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_BITPERM -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2-bitperm -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svuint8_t test_svbgrp_u8(svuint8_t op1, svuint8_t op2)
{
// CHECK-LABEL: test_svbgrp_u8
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.bgrp.x.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
// CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbgrp'}}
// expected-warning@+1 {{implicit declaration of function 'svbgrp_u8'}}
return SVE_ACLE_FUNC(svbgrp,_u8,,)(op1, op2);
}

svuint16_t test_svbgrp_u16(svuint16_t op1, svuint16_t op2)
{
// CHECK-LABEL: test_svbgrp_u16
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.bgrp.x.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
// CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbgrp'}}
// expected-warning@+1 {{implicit declaration of function 'svbgrp_u16'}}
return SVE_ACLE_FUNC(svbgrp,_u16,,)(op1, op2);
}

svuint32_t test_svbgrp_u32(svuint32_t op1, svuint32_t op2)
{
// CHECK-LABEL: test_svbgrp_u32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.bgrp.x.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbgrp'}}
// expected-warning@+1 {{implicit declaration of function 'svbgrp_u32'}}
return SVE_ACLE_FUNC(svbgrp,_u32,,)(op1, op2);
}

svuint64_t test_svbgrp_u64(svuint64_t op1, svuint64_t op2)
{
// CHECK-LABEL: test_svbgrp_u64
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.bgrp.x.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbgrp'}}
// expected-warning@+1 {{implicit declaration of function 'svbgrp_u64'}}
return SVE_ACLE_FUNC(svbgrp,_u64,,)(op1, op2);
}

svuint8_t test_svbgrp_n_u8(svuint8_t op1, uint8_t op2)
{
// CHECK-LABEL: test_svbgrp_n_u8
// CHECK: %[[DUP:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.bgrp.x.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %[[DUP]])
// CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbgrp'}}
// expected-warning@+1 {{implicit declaration of function 'svbgrp_n_u8'}}
return SVE_ACLE_FUNC(svbgrp,_n_u8,,)(op1, op2);
}

svuint16_t test_svbgrp_n_u16(svuint16_t op1, uint16_t op2)
{
// CHECK-LABEL: test_svbgrp_n_u16
// CHECK: %[[DUP:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.dup.x.nxv8i16(i16 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.bgrp.x.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %[[DUP]])
// CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbgrp'}}
// expected-warning@+1 {{implicit declaration of function 'svbgrp_n_u16'}}
return SVE_ACLE_FUNC(svbgrp,_n_u16,,)(op1, op2);
}

svuint32_t test_svbgrp_n_u32(svuint32_t op1, uint32_t op2)
{
// CHECK-LABEL: test_svbgrp_n_u32
// CHECK: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.bgrp.x.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %[[DUP]])
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbgrp'}}
// expected-warning@+1 {{implicit declaration of function 'svbgrp_n_u32'}}
return SVE_ACLE_FUNC(svbgrp,_n_u32,,)(op1, op2);
}

svuint64_t test_svbgrp_n_u64(svuint64_t op1, uint64_t op2)
{
// CHECK-LABEL: test_svbgrp_n_u64
// CHECK: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.bgrp.x.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %[[DUP]])
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svbgrp'}}
// expected-warning@+1 {{implicit declaration of function 'svbgrp_n_u64'}}
return SVE_ACLE_FUNC(svbgrp,_n_u64,,)(op1, op2);
}
57 changes: 57 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_histcnt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svuint32_t test_svhistcnt_s32_z(svbool_t pg, svint32_t op1, svint32_t op2)
{
// CHECK-LABEL: test_svhistcnt_s32_z
// CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.histcnt.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svhistcnt_z'}}
// expected-warning@+1 {{implicit declaration of function 'svhistcnt_s32_z'}}
return SVE_ACLE_FUNC(svhistcnt,_s32,_z,)(pg, op1, op2);
}

svuint64_t test_svhistcnt_s64_z(svbool_t pg, svint64_t op1, svint64_t op2)
{
// CHECK-LABEL: test_svhistcnt_s64_z
// CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.histcnt.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svhistcnt_z'}}
// expected-warning@+1 {{implicit declaration of function 'svhistcnt_s64_z'}}
return SVE_ACLE_FUNC(svhistcnt,_s64,_z,)(pg, op1, op2);
}

svuint32_t test_svhistcnt_u32_z(svbool_t pg, svuint32_t op1, svuint32_t op2)
{
// CHECK-LABEL: test_svhistcnt_u32_z
// CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.histcnt.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svhistcnt_z'}}
// expected-warning@+1 {{implicit declaration of function 'svhistcnt_u32_z'}}
return SVE_ACLE_FUNC(svhistcnt,_u32,_z,)(pg, op1, op2);
}

svuint64_t test_svhistcnt_u64_z(svbool_t pg, svuint64_t op1, svuint64_t op2)
{
// CHECK-LABEL: test_svhistcnt_u64_z
// CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.histcnt.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svhistcnt_z'}}
// expected-warning@+1 {{implicit declaration of function 'svhistcnt_u64_z'}}
return SVE_ACLE_FUNC(svhistcnt,_u64,_z,)(pg, op1, op2);
}
33 changes: 33 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_histseg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svuint8_t test_svhistseg_s8(svint8_t op1, svint8_t op2)
{
// CHECK-LABEL: test_svhistseg_s8
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.histseg.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
// CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svhistseg'}}
// expected-warning@+1 {{implicit declaration of function 'svhistseg_s8'}}
return SVE_ACLE_FUNC(svhistseg,_s8,,)(op1, op2);
}

svuint8_t test_svhistseg_u8(svuint8_t op1, svuint8_t op2)
{
// CHECK-LABEL: test_svhistseg_u8
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.histseg.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
// CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svhistseg'}}
// expected-warning@+1 {{implicit declaration of function 'svhistseg_u8'}}
return SVE_ACLE_FUNC(svhistseg,_u8,,)(op1, op2);
}
112 changes: 112 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_logb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svint16_t test_svlogb_f16_z(svbool_t pg, svfloat16_t op)
{
// CHECK-LABEL: test_svlogb_f16_z
// CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.flogb.nxv8f16(<vscale x 8 x i16> zeroinitializer, <vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op)
// CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svlogb_z'}}
// expected-warning@+1 {{implicit declaration of function 'svlogb_f16_z'}}
return SVE_ACLE_FUNC(svlogb,_f16,_z,)(pg, op);
}

svint32_t test_svlogb_f32_z(svbool_t pg, svfloat32_t op)
{
// CHECK-LABEL: test_svlogb_f32_z
// CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.flogb.nxv4f32(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svlogb_z'}}
// expected-warning@+1 {{implicit declaration of function 'svlogb_f32_z'}}
return SVE_ACLE_FUNC(svlogb,_f32,_z,)(pg, op);
}

svint64_t test_svlogb_f64_z(svbool_t pg, svfloat64_t op)
{
// CHECK-LABEL: test_svlogb_f64_z
// CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.flogb.nxv2f64(<vscale x 2 x i64> zeroinitializer, <vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svlogb_z'}}
// expected-warning@+1 {{implicit declaration of function 'svlogb_f64_z'}}
return SVE_ACLE_FUNC(svlogb,_f64,_z,)(pg, op);
}

svint16_t test_svlogb_f16_m(svint16_t inactive, svbool_t pg, svfloat16_t op)
{
// CHECK-LABEL: test_svlogb_f16_m
// CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.flogb.nxv8f16(<vscale x 8 x i16> %inactive, <vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op)
// CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svlogb_m'}}
// expected-warning@+1 {{implicit declaration of function 'svlogb_f16_m'}}
return SVE_ACLE_FUNC(svlogb,_f16,_m,)(inactive, pg, op);
}

svint32_t test_svlogb_f32_m(svint32_t inactive, svbool_t pg, svfloat32_t op)
{
// CHECK-LABEL: test_svlogb_f32_m
// CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.flogb.nxv4f32(<vscale x 4 x i32> %inactive, <vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svlogb_m'}}
// expected-warning@+1 {{implicit declaration of function 'svlogb_f32_m'}}
return SVE_ACLE_FUNC(svlogb,_f32,_m,)(inactive, pg, op);
}

svint64_t test_svlogb_f64_m(svint64_t inactive, svbool_t pg, svfloat64_t op)
{
// CHECK-LABEL: test_svlogb_f64_m
// CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.flogb.nxv2f64(<vscale x 2 x i64> %inactive, <vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svlogb_m'}}
// expected-warning@+1 {{implicit declaration of function 'svlogb_f64_m'}}
return SVE_ACLE_FUNC(svlogb,_f64,_m,)(inactive, pg, op);
}

svint16_t test_svlogb_f16_x(svbool_t pg, svfloat16_t op)
{
// CHECK-LABEL: test_svlogb_f16_x
// CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.flogb.nxv8f16(<vscale x 8 x i16> undef, <vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op)
// CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svlogb_x'}}
// expected-warning@+1 {{implicit declaration of function 'svlogb_f16_x'}}
return SVE_ACLE_FUNC(svlogb,_f16,_x,)(pg, op);
}

svint32_t test_svlogb_f32_x(svbool_t pg, svfloat32_t op)
{
// CHECK-LABEL: test_svlogb_f32_x
// CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.flogb.nxv4f32(<vscale x 4 x i32> undef, <vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svlogb_x'}}
// expected-warning@+1 {{implicit declaration of function 'svlogb_f32_x'}}
return SVE_ACLE_FUNC(svlogb,_f32,_x,)(pg, op);
}

svint64_t test_svlogb_f64_x(svbool_t pg, svfloat64_t op)
{
// CHECK-LABEL: test_svlogb_f64_x
// CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.flogb.nxv2f64(<vscale x 2 x i64> undef, <vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svlogb_x'}}
// expected-warning@+1 {{implicit declaration of function 'svlogb_f64_x'}}
return SVE_ACLE_FUNC(svlogb,_f64,_x,)(pg, op);
}
57 changes: 57 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_match.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svbool_t test_svmatch_s8(svbool_t pg, svint8_t op1, svint8_t op2)
{
// CHECK-LABEL: test_svmatch_s8
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.match.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
// CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmatch'}}
// expected-warning@+1 {{implicit declaration of function 'svmatch_s8'}}
return SVE_ACLE_FUNC(svmatch,_s8,,)(pg, op1, op2);
}

svbool_t test_svmatch_s16(svbool_t pg, svint16_t op1, svint16_t op2)
{
// CHECK-LABEL: test_svmatch_s16
// CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.match.nxv8i16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
// CHECK: %[[RET:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
// CHECK: ret <vscale x 16 x i1> %[[RET]]
// overload-warning@+2 {{implicit declaration of function 'svmatch'}}
// expected-warning@+1 {{implicit declaration of function 'svmatch_s16'}}
return SVE_ACLE_FUNC(svmatch,_s16,,)(pg, op1, op2);
}

svbool_t test_svmatch_u8(svbool_t pg, svuint8_t op1, svuint8_t op2)
{
// CHECK-LABEL: test_svmatch_u8
// CHECK: %[[intrinsic:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.match.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
// CHECK: ret <vscale x 16 x i1> %[[intrinsic]]
// overload-warning@+2 {{implicit declaration of function 'svmatch'}}
// expected-warning@+1 {{implicit declaration of function 'svmatch_u8'}}
return SVE_ACLE_FUNC(svmatch,_u8,,)(pg, op1, op2);
}

svbool_t test_svmatch_u16(svbool_t pg, svuint16_t op1, svuint16_t op2)
{
// CHECK-LABEL: test_svmatch_u16
// CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.match.nxv8i16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
// CHECK: %[[RET:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
// CHECK: ret <vscale x 16 x i1> %[[RET]]
// overload-warning@+2 {{implicit declaration of function 'svmatch'}}
// expected-warning@+1 {{implicit declaration of function 'svmatch_u16'}}
return SVE_ACLE_FUNC(svmatch,_u16,,)(pg, op1, op2);
}
41 changes: 41 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_mlalb.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,44 @@ svuint64_t test_svmlalb_lane_u64_1(svuint64_t op1, svuint32_t op2, svuint32_t op
// expected-warning@+1 {{implicit declaration of function 'svmlalb_lane_u64'}}
return SVE_ACLE_FUNC(svmlalb_lane,_u64,,)(op1, op2, op3, 3);
}

svfloat32_t test_svmlalb_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlalb_f32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlalb.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlalb'}}
// expected-warning@+1 {{implicit declaration of function 'svmlalb_f32'}}
return SVE_ACLE_FUNC(svmlalb,_f32,,)(op1, op2, op3);
}

svfloat32_t test_svmlalb_n_f32(svfloat32_t op1, svfloat16_t op2, float16_t op3)
{
// CHECK-LABEL: test_svmlalb_n_f32
// CHECK: %[[DUP:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half %op3)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlalb.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %[[DUP]])
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlalb'}}
// expected-warning@+1 {{implicit declaration of function 'svmlalb_n_f32'}}
return SVE_ACLE_FUNC(svmlalb,_n_f32,,)(op1, op2, op3);
}

svfloat32_t test_svmlalb_lane_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlalb_lane_f32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlalb.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 0)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlalb_lane'}}
// expected-warning@+1 {{implicit declaration of function 'svmlalb_lane_f32'}}
return SVE_ACLE_FUNC(svmlalb_lane,_f32,,)(op1, op2, op3, 0);
}

svfloat32_t test_svmlalb_lane_f32_1(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlalb_lane_f32_1
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlalb.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 7)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlalb_lane'}}
// expected-warning@+1 {{implicit declaration of function 'svmlalb_lane_f32'}}
return SVE_ACLE_FUNC(svmlalb_lane,_f32,,)(op1, op2, op3, 7);
}
41 changes: 41 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_mlalt.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,44 @@ svuint64_t test_svmlalt_lane_u64_1(svuint64_t op1, svuint32_t op2, svuint32_t op
// expected-warning@+1 {{implicit declaration of function 'svmlalt_lane_u64'}}
return SVE_ACLE_FUNC(svmlalt_lane,_u64,,)(op1, op2, op3, 3);
}

svfloat32_t test_svmlalt_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlalt_f32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlalt.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlalt'}}
// expected-warning@+1 {{implicit declaration of function 'svmlalt_f32'}}
return SVE_ACLE_FUNC(svmlalt,_f32,,)(op1, op2, op3);
}

svfloat32_t test_svmlalt_n_f32(svfloat32_t op1, svfloat16_t op2, float16_t op3)
{
// CHECK-LABEL: test_svmlalt_n_f32
// CHECK: %[[DUP:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half %op3)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlalt.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %[[DUP]])
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlalt'}}
// expected-warning@+1 {{implicit declaration of function 'svmlalt_n_f32'}}
return SVE_ACLE_FUNC(svmlalt,_n_f32,,)(op1, op2, op3);
}

svfloat32_t test_svmlalt_lane_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlalt_lane_f32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlalt.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 0)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlalt_lane'}}
// expected-warning@+1 {{implicit declaration of function 'svmlalt_lane_f32'}}
return SVE_ACLE_FUNC(svmlalt_lane,_f32,,)(op1, op2, op3, 0);
}

svfloat32_t test_svmlalt_lane_f32_1(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlalt_lane_f32_1
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlalt.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 7)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlalt_lane'}}
// expected-warning@+1 {{implicit declaration of function 'svmlalt_lane_f32'}}
return SVE_ACLE_FUNC(svmlalt_lane,_f32,,)(op1, op2, op3, 7);
}
41 changes: 41 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_mlslb.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,44 @@ svuint64_t test_svmlslb_lane_u64_1(svuint64_t op1, svuint32_t op2, svuint32_t op
// expected-warning@+1 {{implicit declaration of function 'svmlslb_lane_u64'}}
return SVE_ACLE_FUNC(svmlslb_lane,_u64,,)(op1, op2, op3, 3);
}

svfloat32_t test_svmlslb_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlslb_f32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlslb.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlslb'}}
// expected-warning@+1 {{implicit declaration of function 'svmlslb_f32'}}
return SVE_ACLE_FUNC(svmlslb,_f32,,)(op1, op2, op3);
}

svfloat32_t test_svmlslb_n_f32(svfloat32_t op1, svfloat16_t op2, float16_t op3)
{
// CHECK-LABEL: test_svmlslb_n_f32
// CHECK: %[[DUP:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half %op3)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlslb.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %[[DUP]])
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlslb'}}
// expected-warning@+1 {{implicit declaration of function 'svmlslb_n_f32'}}
return SVE_ACLE_FUNC(svmlslb,_n_f32,,)(op1, op2, op3);
}

svfloat32_t test_svmlslb_lane_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlslb_lane_f32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlslb.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 0)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlslb_lane'}}
// expected-warning@+1 {{implicit declaration of function 'svmlslb_lane_f32'}}
return SVE_ACLE_FUNC(svmlslb_lane,_f32,,)(op1, op2, op3, 0);
}

svfloat32_t test_svmlslb_lane_f32_1(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlslb_lane_f32_1
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlslb.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 7)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlslb_lane'}}
// expected-warning@+1 {{implicit declaration of function 'svmlslb_lane_f32'}}
return SVE_ACLE_FUNC(svmlslb_lane,_f32,,)(op1, op2, op3, 7);
}
41 changes: 41 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_mlslt.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,44 @@ svuint64_t test_svmlslt_lane_u64_1(svuint64_t op1, svuint32_t op2, svuint32_t op
// expected-warning@+1 {{implicit declaration of function 'svmlslt_lane_u64'}}
return SVE_ACLE_FUNC(svmlslt_lane,_u64,,)(op1, op2, op3, 3);
}

svfloat32_t test_svmlslt_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlslt_f32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlslt.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlslt'}}
// expected-warning@+1 {{implicit declaration of function 'svmlslt_f32'}}
return SVE_ACLE_FUNC(svmlslt,_f32,,)(op1, op2, op3);
}

svfloat32_t test_svmlslt_n_f32(svfloat32_t op1, svfloat16_t op2, float16_t op3)
{
// CHECK-LABEL: test_svmlslt_n_f32
// CHECK: %[[DUP:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half %op3)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlslt.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %[[DUP]])
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlslt'}}
// expected-warning@+1 {{implicit declaration of function 'svmlslt_n_f32'}}
return SVE_ACLE_FUNC(svmlslt,_n_f32,,)(op1, op2, op3);
}

svfloat32_t test_svmlslt_lane_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlslt_lane_f32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlslt.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 0)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlslt_lane'}}
// expected-warning@+1 {{implicit declaration of function 'svmlslt_lane_f32'}}
return SVE_ACLE_FUNC(svmlslt_lane,_f32,,)(op1, op2, op3, 0);
}

svfloat32_t test_svmlslt_lane_f32_1(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// CHECK-LABEL: test_svmlslt_lane_f32_1
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmlslt.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 7)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svmlslt_lane'}}
// expected-warning@+1 {{implicit declaration of function 'svmlslt_lane_f32'}}
return SVE_ACLE_FUNC(svmlslt_lane,_f32,,)(op1, op2, op3, 7);
}
57 changes: 57 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_nmatch.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svbool_t test_svnmatch_s8(svbool_t pg, svint8_t op1, svint8_t op2)
{
// CHECK-LABEL: test_svnmatch_s8
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.nmatch.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
// CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svnmatch'}}
// expected-warning@+1 {{implicit declaration of function 'svnmatch_s8'}}
return SVE_ACLE_FUNC(svnmatch,_s8,,)(pg, op1, op2);
}

svbool_t test_svnmatch_s16(svbool_t pg, svint16_t op1, svint16_t op2)
{
// CHECK-LABEL: test_svnmatch_s16
// CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.nmatch.nxv8i16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
// CHECK: %[[RET:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
// CHECK: ret <vscale x 16 x i1> %[[RET]]
// overload-warning@+2 {{implicit declaration of function 'svnmatch'}}
// expected-warning@+1 {{implicit declaration of function 'svnmatch_s16'}}
return SVE_ACLE_FUNC(svnmatch,_s16,,)(pg, op1, op2);
}

svbool_t test_svnmatch_u8(svbool_t pg, svuint8_t op1, svuint8_t op2)
{
// CHECK-LABEL: test_svnmatch_u8
// CHECK: %[[intrinsic:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.nmatch.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
// CHECK: ret <vscale x 16 x i1> %[[intrinsic]]
// overload-warning@+2 {{implicit declaration of function 'svnmatch'}}
// expected-warning@+1 {{implicit declaration of function 'svnmatch_u8'}}
return SVE_ACLE_FUNC(svnmatch,_u8,,)(pg, op1, op2);
}

svbool_t test_svnmatch_u16(svbool_t pg, svuint16_t op1, svuint16_t op2)
{
// CHECK-LABEL: test_svnmatch_u16
// CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.nmatch.nxv8i16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
// CHECK: %[[RET:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
// CHECK: ret <vscale x 16 x i1> %[[RET]]
// overload-warning@+2 {{implicit declaration of function 'svnmatch'}}
// expected-warning@+1 {{implicit declaration of function 'svnmatch_u16'}}
return SVE_ACLE_FUNC(svnmatch,_u16,,)(pg, op1, op2);
}
34 changes: 34 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_pmullb_128.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_AES -triple aarch64-none-linux-gnu -target-feature +sve2-aes -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_AES -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2-aes -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svuint64_t test_svpmullb_pair_u64(svuint64_t op1, svuint64_t op2)
{
// CHECK-LABEL: test_svpmullb_pair_u64
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.pmullb.pair.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svpmullb_pair'}}
// expected-warning@+1 {{implicit declaration of function 'svpmullb_pair_u64'}}
return SVE_ACLE_FUNC(svpmullb_pair,_u64,,)(op1, op2);
}

svuint64_t test_svpmullb_pair_n_u64(svuint64_t op1, uint64_t op2)
{
// CHECK-LABEL: test_svpmullb_pair_n_u64
// CHECK: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.pmullb.pair.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %[[DUP]])
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svpmullb_pair'}}
// expected-warning@+1 {{implicit declaration of function 'svpmullb_pair_n_u64'}}
return SVE_ACLE_FUNC(svpmullb_pair,_n_u64,,)(op1, op2);
}
34 changes: 34 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_pmullt_128.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_AES -triple aarch64-none-linux-gnu -target-feature +sve2-aes -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_AES -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2-aes -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svuint64_t test_svpmullt_pair_u64(svuint64_t op1, svuint64_t op2)
{
// CHECK-LABEL: test_svpmullt_pair_u64
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.pmullt.pair.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svpmullt_pair'}}
// expected-warning@+1 {{implicit declaration of function 'svpmullt_pair_u64'}}
return SVE_ACLE_FUNC(svpmullt_pair,_u64,,)(op1, op2);
}

svuint64_t test_svpmullt_pair_n_u64(svuint64_t op1, uint64_t op2)
{
// CHECK-LABEL: test_svpmullt_pair_n_u64
// CHECK: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.pmullt.pair.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %[[DUP]])
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svpmullt_pair'}}
// expected-warning@+1 {{implicit declaration of function 'svpmullt_pair_n_u64'}}
return SVE_ACLE_FUNC(svpmullt_pair,_n_u64,,)(op1, op2);
}
33 changes: 33 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_rax1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_SHA3 -triple aarch64-none-linux-gnu -target-feature +sve2-sha3 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_SHA3 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2-sha3 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svint64_t test_svrax1_s64(svint64_t op1, svint64_t op2)
{
// CHECK-LABEL: test_svrax1_s64
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.rax1(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svrax1'}}
// expected-warning@+1 {{implicit declaration of function 'svrax1_s64'}}
return SVE_ACLE_FUNC(svrax1,_s64,,)(op1, op2);
}

svuint64_t test_svrax1_u64(svuint64_t op1, svuint64_t op2)
{
// CHECK-LABEL: test_svrax1_u64
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.rax1(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svrax1'}}
// expected-warning@+1 {{implicit declaration of function 'svrax1_u64'}}
return SVE_ACLE_FUNC(svrax1,_u64,,)(op1, op2);
}
23 changes: 23 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_sm4e.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_SM4 -triple aarch64-none-linux-gnu -target-feature +sve2-sm4 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_SM4 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2-sm4 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svuint32_t test_svsm4e_u32(svuint32_t op1, svuint32_t op2)
{
// CHECK-LABEL: test_svsm4e_u32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sm4e(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svsm4e'}}
// expected-warning@+1 {{implicit declaration of function 'svsm4e_u32'}}
return SVE_ACLE_FUNC(svsm4e,_u32,,)(op1, op2);
}
23 changes: 23 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_sm4ekey.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_SM4 -triple aarch64-none-linux-gnu -target-feature +sve2-sm4 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2_SM4 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2-sm4 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#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

svuint32_t test_svsm4ekey_u32(svuint32_t op1, svuint32_t op2)
{
// CHECK-LABEL: test_svsm4ekey_u32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sm4ekey(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svsm4ekey'}}
// expected-warning@+1 {{implicit declaration of function 'svsm4ekey_u32'}}
return SVE_ACLE_FUNC(svsm4ekey,_u32,,)(op1, op2);
}
123 changes: 123 additions & 0 deletions clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s

#include <arm_sve.h>

#ifdef SVE_OVERLOADED_FORMS
// A simple used,unused... macro, long enough to represent any SVE builtin.
#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
#else
#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
#endif

svint8_t test_svtbx_s8(svint8_t fallback, svint8_t data, svuint8_t indices)
{
// CHECK-LABEL: test_svtbx_s8
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.tbx.nxv16i8(<vscale x 16 x i8> %fallback, <vscale x 16 x i8> %data, <vscale x 16 x i8> %indices)
// CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_s8'}}
return SVE_ACLE_FUNC(svtbx,_s8,,)(fallback, data, indices);
}

svint16_t test_svtbx_s16(svint16_t fallback, svint16_t data, svuint16_t indices)
{
// CHECK-LABEL: test_svtbx_s16
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.tbx.nxv8i16(<vscale x 8 x i16> %fallback, <vscale x 8 x i16> %data, <vscale x 8 x i16> %indices)
// CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_s16'}}
return SVE_ACLE_FUNC(svtbx,_s16,,)(fallback, data, indices);
}

svint32_t test_svtbx_s32(svint32_t fallback, svint32_t data, svuint32_t indices)
{
// CHECK-LABEL: test_svtbx_s32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.tbx.nxv4i32(<vscale x 4 x i32> %fallback, <vscale x 4 x i32> %data, <vscale x 4 x i32> %indices)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_s32'}}
return SVE_ACLE_FUNC(svtbx,_s32,,)(fallback, data, indices);
}

svint64_t test_svtbx_s64(svint64_t fallback, svint64_t data, svuint64_t indices)
{
// CHECK-LABEL: test_svtbx_s64
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.tbx.nxv2i64(<vscale x 2 x i64> %fallback, <vscale x 2 x i64> %data, <vscale x 2 x i64> %indices)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_s64'}}
return SVE_ACLE_FUNC(svtbx,_s64,,)(fallback, data, indices);
}

svuint8_t test_svtbx_u8(svuint8_t fallback, svuint8_t data, svuint8_t indices)
{
// CHECK-LABEL: test_svtbx_u8
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.tbx.nxv16i8(<vscale x 16 x i8> %fallback, <vscale x 16 x i8> %data, <vscale x 16 x i8> %indices)
// CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_u8'}}
return SVE_ACLE_FUNC(svtbx,_u8,,)(fallback, data, indices);
}

svuint16_t test_svtbx_u16(svuint16_t fallback, svuint16_t data, svuint16_t indices)
{
// CHECK-LABEL: test_svtbx_u16
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.tbx.nxv8i16(<vscale x 8 x i16> %fallback, <vscale x 8 x i16> %data, <vscale x 8 x i16> %indices)
// CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_u16'}}
return SVE_ACLE_FUNC(svtbx,_u16,,)(fallback, data, indices);
}

svuint32_t test_svtbx_u32(svuint32_t fallback, svuint32_t data, svuint32_t indices)
{
// CHECK-LABEL: test_svtbx_u32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.tbx.nxv4i32(<vscale x 4 x i32> %fallback, <vscale x 4 x i32> %data, <vscale x 4 x i32> %indices)
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_u32'}}
return SVE_ACLE_FUNC(svtbx,_u32,,)(fallback, data, indices);
}

svuint64_t test_svtbx_u64(svuint64_t fallback, svuint64_t data, svuint64_t indices)
{
// CHECK-LABEL: test_svtbx_u64
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.tbx.nxv2i64(<vscale x 2 x i64> %fallback, <vscale x 2 x i64> %data, <vscale x 2 x i64> %indices)
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_u64'}}
return SVE_ACLE_FUNC(svtbx,_u64,,)(fallback, data, indices);
}

svfloat16_t test_svtbx_f16(svfloat16_t fallback, svfloat16_t data, svuint16_t indices)
{
// CHECK-LABEL: test_svtbx_f16
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.tbx.nxv8f16(<vscale x 8 x half> %fallback, <vscale x 8 x half> %data, <vscale x 8 x i16> %indices)
// CHECK: ret <vscale x 8 x half> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_f16'}}
return SVE_ACLE_FUNC(svtbx,_f16,,)(fallback, data, indices);
}

svfloat32_t test_svtbx_f32(svfloat32_t fallback, svfloat32_t data, svuint32_t indices)
{
// CHECK-LABEL: test_svtbx_f32
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.tbx.nxv4f32(<vscale x 4 x float> %fallback, <vscale x 4 x float> %data, <vscale x 4 x i32> %indices)
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_f32'}}
return SVE_ACLE_FUNC(svtbx,_f32,,)(fallback, data, indices);
}

svfloat64_t test_svtbx_f64(svfloat64_t fallback, svfloat64_t data, svuint64_t indices)
{
// CHECK-LABEL: test_svtbx_f64
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.tbx.nxv2f64(<vscale x 2 x double> %fallback, <vscale x 2 x double> %data, <vscale x 2 x i64> %indices)
// CHECK: ret <vscale x 2 x double> %[[INTRINSIC]]
// overload-warning@+2 {{implicit declaration of function 'svtbx'}}
// expected-warning@+1 {{implicit declaration of function 'svtbx_f64'}}
return SVE_ACLE_FUNC(svtbx,_f64,,)(fallback, data, indices);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ svuint64_t test_svmlalb_lane_u64(svuint64_t op1, svuint32_t op2, svuint32_t op3)
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 3]}}
return SVE_ACLE_FUNC(svmlalb_lane,_u64,,)(op1, op2, op3, 4);
}

svfloat32_t test_svmlalb_lane_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
return SVE_ACLE_FUNC(svmlalb_lane,_f32,,)(op1, op2, op3, -1);
}

svfloat32_t test_svmlalb_lane_f32_1(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
return SVE_ACLE_FUNC(svmlalb_lane,_f32,,)(op1, op2, op3, 8);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ svuint64_t test_svmlalt_lane_u64(svuint64_t op1, svuint32_t op2, svuint32_t op3)
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 3]}}
return SVE_ACLE_FUNC(svmlalt_lane,_u64,,)(op1, op2, op3, 4);
}

svfloat32_t test_svmlalt_lane_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
return SVE_ACLE_FUNC(svmlalt_lane,_f32,,)(op1, op2, op3, -1);
}

svfloat32_t test_svmlalt_lane_f32_1(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
return SVE_ACLE_FUNC(svmlalt_lane,_f32,,)(op1, op2, op3, 8);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ svuint64_t test_svmlslb_lane_u64(svuint64_t op1, svuint32_t op2, svuint32_t op3)
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 3]}}
return SVE_ACLE_FUNC(svmlslb_lane,_u64,,)(op1, op2, op3, 4);
}

svfloat32_t test_svmlslb_lane_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
return SVE_ACLE_FUNC(svmlslb_lane,_f32,,)(op1, op2, op3, -1);
}

svfloat32_t test_svmlslb_lane_f32_1(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
return SVE_ACLE_FUNC(svmlslb_lane,_f32,,)(op1, op2, op3, 8);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ svuint64_t test_svmlslt_lane_u64(svuint64_t op1, svuint32_t op2, svuint32_t op3)
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 3]}}
return SVE_ACLE_FUNC(svmlslt_lane,_u64,,)(op1, op2, op3, 4);
}

svfloat32_t test_svmlslt_lane_f32(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
return SVE_ACLE_FUNC(svmlslt_lane,_f32,,)(op1, op2, op3, -1);
}

svfloat32_t test_svmlslt_lane_f32_1(svfloat32_t op1, svfloat16_t op2, svfloat16_t op3)
{
// expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
return SVE_ACLE_FUNC(svmlslt_lane,_f32,,)(op1, op2, op3, 8);
}