1 // RUN: %clang_cc1 -target-feature +i8mm -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -target-feature +i8mm -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
3 // RUN: %clang_cc1 -target-feature +i8mm -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4 // RUN: %clang_cc1 -target-feature +i8mm -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
5 
6 #include <arm_sve.h>
7 
8 #ifdef SVE_OVERLOADED_FORMS
9 // A simple used,unused... macro, long enough to represent any SVE builtin.
10 #define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3
11 #else
12 #define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
13 #endif
14 
test_svsudot_s32(svint32_t x,svint8_t y,svuint8_t z)15 svint32_t test_svsudot_s32(svint32_t x, svint8_t y, svuint8_t z) {
16   // CHECK-LABEL: test_svsudot_s32
17   // CHECK: %[[RET:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.usdot.nxv4i32(<vscale x 4 x i32> %x, <vscale x 16 x i8> %z, <vscale x 16 x i8> %y)
18   // CHECK: ret <vscale x 4 x i32> %[[RET]]
19   return SVE_ACLE_FUNC(svsudot, _s32, , )(x, y, z);
20 }
21 
test_svsudot_n_s32(svint32_t x,svint8_t y,uint8_t z)22 svint32_t test_svsudot_n_s32(svint32_t x, svint8_t y, uint8_t z) {
23   // CHECK-LABEL: test_svsudot_n_s32
24   // CHECK: %[[SPLAT:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 %z)
25   // CHECK: %[[RET:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.usdot.nxv4i32(<vscale x 4 x i32> %x, <vscale x 16 x i8> %[[SPLAT]], <vscale x 16 x i8> %y)
26   // CHECK: ret <vscale x 4 x i32> %[[RET]]
27   return SVE_ACLE_FUNC(svsudot, _n_s32, , )(x, y, z);
28 }
29 
test_svsudot_lane_s32_0(svint32_t x,svint8_t y,svuint8_t z)30 svint32_t test_svsudot_lane_s32_0(svint32_t x, svint8_t y, svuint8_t z) {
31   // CHECK-LABEL: test_svsudot_lane_s32_0
32   // CHECK: %[[RET:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sudot.lane.nxv4i32(<vscale x 4 x i32> %x, <vscale x 16 x i8> %y, <vscale x 16 x i8> %z, i32 0)
33   // CHECK: ret <vscale x 4 x i32> %[[RET]]
34   return SVE_ACLE_FUNC(svsudot_lane, _s32, , )(x, y, z, 0);
35 }
36 
test_svsudot_lane_s32_1(svint32_t x,svint8_t y,svuint8_t z)37 svint32_t test_svsudot_lane_s32_1(svint32_t x, svint8_t y, svuint8_t z) {
38   // CHECK-LABEL: test_svsudot_lane_s32_1
39   // CHECK: %[[RET:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sudot.lane.nxv4i32(<vscale x 4 x i32> %x, <vscale x 16 x i8> %y, <vscale x 16 x i8> %z, i32 1)
40   // CHECK: ret <vscale x 4 x i32> %[[RET]]
41   return SVE_ACLE_FUNC(svsudot_lane, _s32, , )(x, y, z, 1);
42 }
43 
test_svsudot_lane_s32_2(svint32_t x,svint8_t y,svuint8_t z)44 svint32_t test_svsudot_lane_s32_2(svint32_t x, svint8_t y, svuint8_t z) {
45   // CHECK-LABEL: test_svsudot_lane_s32_2
46   // CHECK: %[[RET:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sudot.lane.nxv4i32(<vscale x 4 x i32> %x, <vscale x 16 x i8> %y, <vscale x 16 x i8> %z, i32 2)
47   // CHECK: ret <vscale x 4 x i32> %[[RET]]
48   return SVE_ACLE_FUNC(svsudot_lane, _s32, , )(x, y, z, 2);
49 }
50 
test_svsudot_lane_s32_3(svint32_t x,svint8_t y,svuint8_t z)51 svint32_t test_svsudot_lane_s32_3(svint32_t x, svint8_t y, svuint8_t z) {
52   // CHECK-LABEL: test_svsudot_lane_s32_3
53   // CHECK: %[[RET:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sudot.lane.nxv4i32(<vscale x 4 x i32> %x, <vscale x 16 x i8> %y, <vscale x 16 x i8> %z, i32 3)
54   // CHECK: ret <vscale x 4 x i32> %[[RET]]
55   return SVE_ACLE_FUNC(svsudot_lane, _s32, , )(x, y, z, 3);
56 }
57