1 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
3 // RUN: %clang_cc1 -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
4 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
5 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error -verify-ignore-unexpected=note %s
6 
7 #include <arm_sve.h>
8 
9 #ifdef SVE_OVERLOADED_FORMS
10 // A simple used,unused... macro, long enough to represent any SVE builtin.
11 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
12 #else
13 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
14 #endif
15 
test_svmla_lane_s16(svint16_t op1,svint16_t op2,svint16_t op3)16 svint16_t test_svmla_lane_s16(svint16_t op1, svint16_t op2, svint16_t op3)
17 {
18   // CHECK-LABEL: test_svmla_lane_s16
19   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.mla.lane.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 0)
20   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
21   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_s16'}}
22   return SVE_ACLE_FUNC(svmla_lane,_s16,,)(op1, op2, op3, 0);
23 }
24 
test_svmla_lane_s16_1(svint16_t op1,svint16_t op2,svint16_t op3)25 svint16_t test_svmla_lane_s16_1(svint16_t op1, svint16_t op2, svint16_t op3)
26 {
27   // CHECK-LABEL: test_svmla_lane_s16_1
28   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.mla.lane.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 7)
29   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
30   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_s16'}}
31   return SVE_ACLE_FUNC(svmla_lane,_s16,,)(op1, op2, op3, 7);
32 }
33 
test_svmla_lane_s32(svint32_t op1,svint32_t op2,svint32_t op3)34 svint32_t test_svmla_lane_s32(svint32_t op1, svint32_t op2, svint32_t op3)
35 {
36   // CHECK-LABEL: test_svmla_lane_s32
37   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.mla.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, <vscale x 4 x i32> %op3, i32 0)
38   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
39   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_s32'}}
40   return SVE_ACLE_FUNC(svmla_lane,_s32,,)(op1, op2, op3, 0);
41 }
42 
test_svmla_lane_s32_1(svint32_t op1,svint32_t op2,svint32_t op3)43 svint32_t test_svmla_lane_s32_1(svint32_t op1, svint32_t op2, svint32_t op3)
44 {
45   // CHECK-LABEL: test_svmla_lane_s32_1
46   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.mla.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, <vscale x 4 x i32> %op3, i32 3)
47   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
48   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_s32'}}
49   return SVE_ACLE_FUNC(svmla_lane,_s32,,)(op1, op2, op3, 3);
50 }
51 
test_svmla_lane_s64(svint64_t op1,svint64_t op2,svint64_t op3)52 svint64_t test_svmla_lane_s64(svint64_t op1, svint64_t op2, svint64_t op3)
53 {
54   // CHECK-LABEL: test_svmla_lane_s64
55   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.mla.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, <vscale x 2 x i64> %op3, i32 0)
56   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
57   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_s64'}}
58   return SVE_ACLE_FUNC(svmla_lane,_s64,,)(op1, op2, op3, 0);
59 }
60 
test_svmla_lane_s64_1(svint64_t op1,svint64_t op2,svint64_t op3)61 svint64_t test_svmla_lane_s64_1(svint64_t op1, svint64_t op2, svint64_t op3)
62 {
63   // CHECK-LABEL: test_svmla_lane_s64_1
64   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.mla.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, <vscale x 2 x i64> %op3, i32 1)
65   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
66   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_s64'}}
67   return SVE_ACLE_FUNC(svmla_lane,_s64,,)(op1, op2, op3, 1);
68 }
69 
test_svmla_lane_u16(svuint16_t op1,svuint16_t op2,svuint16_t op3)70 svuint16_t test_svmla_lane_u16(svuint16_t op1, svuint16_t op2, svuint16_t op3)
71 {
72   // CHECK-LABEL: test_svmla_lane_u16
73   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.mla.lane.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 0)
74   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
75   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_u16'}}
76   return SVE_ACLE_FUNC(svmla_lane,_u16,,)(op1, op2, op3, 0);
77 }
78 
test_svmla_lane_u16_1(svuint16_t op1,svuint16_t op2,svuint16_t op3)79 svuint16_t test_svmla_lane_u16_1(svuint16_t op1, svuint16_t op2, svuint16_t op3)
80 {
81   // CHECK-LABEL: test_svmla_lane_u16_1
82   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.mla.lane.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 7)
83   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
84   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_u16'}}
85   return SVE_ACLE_FUNC(svmla_lane,_u16,,)(op1, op2, op3, 7);
86 }
87 
test_svmla_lane_u32_1(svuint32_t op1,svuint32_t op2,svuint32_t op3)88 svuint32_t test_svmla_lane_u32_1(svuint32_t op1, svuint32_t op2, svuint32_t op3)
89 {
90   // CHECK-LABEL: test_svmla_lane_u32_1
91   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.mla.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, <vscale x 4 x i32> %op3, i32 3)
92   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
93   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_u32'}}
94   return SVE_ACLE_FUNC(svmla_lane,_u32,,)(op1, op2, op3, 3);
95 }
96 
test_svmla_lane_u64(svuint64_t op1,svuint64_t op2,svuint64_t op3)97 svuint64_t test_svmla_lane_u64(svuint64_t op1, svuint64_t op2, svuint64_t op3)
98 {
99   // CHECK-LABEL: test_svmla_lane_u64
100   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.mla.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, <vscale x 2 x i64> %op3, i32 0)
101   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
102   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_u64'}}
103   return SVE_ACLE_FUNC(svmla_lane,_u64,,)(op1, op2, op3, 0);
104 }
105 
test_svmla_lane_u64_1(svuint64_t op1,svuint64_t op2,svuint64_t op3)106 svuint64_t test_svmla_lane_u64_1(svuint64_t op1, svuint64_t op2, svuint64_t op3)
107 {
108   // CHECK-LABEL: test_svmla_lane_u64_1
109   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.mla.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, <vscale x 2 x i64> %op3, i32 1)
110   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
111   // expected-warning@+1 {{implicit declaration of function 'svmla_lane_u64'}}
112   return SVE_ACLE_FUNC(svmla_lane,_u64,,)(op1, op2, op3, 1);
113 }
114