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 -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
3
4 #include <arm_sve.h>
5
6 #ifdef SVE_OVERLOADED_FORMS
7 // A simple used,unused... macro, long enough to represent any SVE builtin.
8 #define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3
9 #else
10 #define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
11 #endif
12
test_svsudot_s32(svint32_t x,svint8_t y,svuint8_t z)13 svint32_t test_svsudot_s32(svint32_t x, svint8_t y, svuint8_t z) {
14 // CHECK-LABEL: test_svsudot_s32
15 // 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)
16 // CHECK: ret <vscale x 4 x i32> %[[RET]]
17 return SVE_ACLE_FUNC(svsudot, _s32, , )(x, y, z);
18 }
19
test_svsudot_n_s32(svint32_t x,svint8_t y,uint8_t z)20 svint32_t test_svsudot_n_s32(svint32_t x, svint8_t y, uint8_t z) {
21 // CHECK-LABEL: test_svsudot_n_s32
22 // CHECK: %[[SPLAT:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 %z)
23 // 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)
24 // CHECK: ret <vscale x 4 x i32> %[[RET]]
25 return SVE_ACLE_FUNC(svsudot, _n_s32, , )(x, y, z);
26 }
27
test_svsudot_lane_s32_0(svint32_t x,svint8_t y,svuint8_t z)28 svint32_t test_svsudot_lane_s32_0(svint32_t x, svint8_t y, svuint8_t z) {
29 // CHECK-LABEL: test_svsudot_lane_s32_0
30 // 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)
31 // CHECK: ret <vscale x 4 x i32> %[[RET]]
32 return SVE_ACLE_FUNC(svsudot_lane, _s32, , )(x, y, z, 0);
33 }
34
test_svsudot_lane_s32_1(svint32_t x,svint8_t y,svuint8_t z)35 svint32_t test_svsudot_lane_s32_1(svint32_t x, svint8_t y, svuint8_t z) {
36 // CHECK-LABEL: test_svsudot_lane_s32_1
37 // 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)
38 // CHECK: ret <vscale x 4 x i32> %[[RET]]
39 return SVE_ACLE_FUNC(svsudot_lane, _s32, , )(x, y, z, 1);
40 }
41
test_svsudot_lane_s32_2(svint32_t x,svint8_t y,svuint8_t z)42 svint32_t test_svsudot_lane_s32_2(svint32_t x, svint8_t y, svuint8_t z) {
43 // CHECK-LABEL: test_svsudot_lane_s32_2
44 // 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)
45 // CHECK: ret <vscale x 4 x i32> %[[RET]]
46 return SVE_ACLE_FUNC(svsudot_lane, _s32, , )(x, y, z, 2);
47 }
48
test_svsudot_lane_s32_3(svint32_t x,svint8_t y,svuint8_t z)49 svint32_t test_svsudot_lane_s32_3(svint32_t x, svint8_t y, svuint8_t z) {
50 // CHECK-LABEL: test_svsudot_lane_s32_3
51 // 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)
52 // CHECK: ret <vscale x 4 x i32> %[[RET]]
53 return SVE_ACLE_FUNC(svsudot_lane, _s32, , )(x, y, z, 3);
54 }
55