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 %s
6 // RUN: %clang_cc1 -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
7 
8 #include <arm_sve.h>
9 
10 #ifdef SVE_OVERLOADED_FORMS
11 // A simple used,unused... macro, long enough to represent any SVE builtin.
12 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
13 #else
14 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
15 #endif
16 
test_svqdmlslb_s16(svint16_t op1,svint8_t op2,svint8_t op3)17 svint16_t test_svqdmlslb_s16(svint16_t op1, svint8_t op2, svint8_t op3)
18 {
19   // CHECK-LABEL: test_svqdmlslb_s16
20   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.sqdmlslb.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3)
21   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
22   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb'}}
23   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_s16'}}
24   return SVE_ACLE_FUNC(svqdmlslb,_s16,,)(op1, op2, op3);
25 }
26 
test_svqdmlslb_s32(svint32_t op1,svint16_t op2,svint16_t op3)27 svint32_t test_svqdmlslb_s32(svint32_t op1, svint16_t op2, svint16_t op3)
28 {
29   // CHECK-LABEL: test_svqdmlslb_s32
30   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sqdmlslb.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3)
31   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
32   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb'}}
33   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_s32'}}
34   return SVE_ACLE_FUNC(svqdmlslb,_s32,,)(op1, op2, op3);
35 }
36 
test_svqdmlslb_s64(svint64_t op1,svint32_t op2,svint32_t op3)37 svint64_t test_svqdmlslb_s64(svint64_t op1, svint32_t op2, svint32_t op3)
38 {
39   // CHECK-LABEL: test_svqdmlslb_s64
40   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sqdmlslb.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 4 x i32> %op2, <vscale x 4 x i32> %op3)
41   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
42   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb'}}
43   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_s64'}}
44   return SVE_ACLE_FUNC(svqdmlslb,_s64,,)(op1, op2, op3);
45 }
46 
test_svqdmlslb_n_s16(svint16_t op1,svint8_t op2,int8_t op3)47 svint16_t test_svqdmlslb_n_s16(svint16_t op1, svint8_t op2, int8_t op3)
48 {
49   // CHECK-LABEL: test_svqdmlslb_n_s16
50   // CHECK: %[[DUP:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 %op3)
51   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.sqdmlslb.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %[[DUP]])
52   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
53   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb'}}
54   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_n_s16'}}
55   return SVE_ACLE_FUNC(svqdmlslb,_n_s16,,)(op1, op2, op3);
56 }
57 
test_svqdmlslb_n_s32(svint32_t op1,svint16_t op2,int16_t op3)58 svint32_t test_svqdmlslb_n_s32(svint32_t op1, svint16_t op2, int16_t op3)
59 {
60   // CHECK-LABEL: test_svqdmlslb_n_s32
61   // CHECK: %[[DUP:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.dup.x.nxv8i16(i16 %op3)
62   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sqdmlslb.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %[[DUP]])
63   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
64   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb'}}
65   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_n_s32'}}
66   return SVE_ACLE_FUNC(svqdmlslb,_n_s32,,)(op1, op2, op3);
67 }
68 
test_svqdmlslb_n_s64(svint64_t op1,svint32_t op2,int32_t op3)69 svint64_t test_svqdmlslb_n_s64(svint64_t op1, svint32_t op2, int32_t op3)
70 {
71   // CHECK-LABEL: test_svqdmlslb_n_s64
72   // CHECK: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op3)
73   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sqdmlslb.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 4 x i32> %op2, <vscale x 4 x i32> %[[DUP]])
74   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
75   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb'}}
76   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_n_s64'}}
77   return SVE_ACLE_FUNC(svqdmlslb,_n_s64,,)(op1, op2, op3);
78 }
79 
test_svqdmlslb_lane_s32(svint32_t op1,svint16_t op2,svint16_t op3)80 svint32_t test_svqdmlslb_lane_s32(svint32_t op1, svint16_t op2, svint16_t op3)
81 {
82   // CHECK-LABEL: test_svqdmlslb_lane_s32
83   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sqdmlslb.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 0)
84   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
85   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb_lane'}}
86   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_lane_s32'}}
87   return SVE_ACLE_FUNC(svqdmlslb_lane,_s32,,)(op1, op2, op3, 0);
88 }
89 
test_svqdmlslb_lane_s32_1(svint32_t op1,svint16_t op2,svint16_t op3)90 svint32_t test_svqdmlslb_lane_s32_1(svint32_t op1, svint16_t op2, svint16_t op3)
91 {
92   // CHECK-LABEL: test_svqdmlslb_lane_s32_1
93   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sqdmlslb.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 7)
94   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
95   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb_lane'}}
96   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_lane_s32'}}
97   return SVE_ACLE_FUNC(svqdmlslb_lane,_s32,,)(op1, op2, op3, 7);
98 }
99 
test_svqdmlslb_lane_s64(svint64_t op1,svint32_t op2,svint32_t op3)100 svint64_t test_svqdmlslb_lane_s64(svint64_t op1, svint32_t op2, svint32_t op3)
101 {
102   // CHECK-LABEL: test_svqdmlslb_lane_s64
103   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sqdmlslb.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 4 x i32> %op2, <vscale x 4 x i32> %op3, i32 0)
104   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
105   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb_lane'}}
106   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_lane_s64'}}
107   return SVE_ACLE_FUNC(svqdmlslb_lane,_s64,,)(op1, op2, op3, 0);
108 }
109 
test_svqdmlslb_lane_s64_1(svint64_t op1,svint32_t op2,svint32_t op3)110 svint64_t test_svqdmlslb_lane_s64_1(svint64_t op1, svint32_t op2, svint32_t op3)
111 {
112   // CHECK-LABEL: test_svqdmlslb_lane_s64_1
113   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sqdmlslb.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 4 x i32> %op2, <vscale x 4 x i32> %op3, i32 3)
114   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
115   // overload-warning@+2 {{implicit declaration of function 'svqdmlslb_lane'}}
116   // expected-warning@+1 {{implicit declaration of function 'svqdmlslb_lane_s64'}}
117   return SVE_ACLE_FUNC(svqdmlslb_lane,_s64,,)(op1, op2, op3, 3);
118 }
119