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_svqabs_s8_z(svbool_t pg,svint8_t op)17 svint8_t test_svqabs_s8_z(svbool_t pg, svint8_t op)
18 {
19   // CHECK-LABEL: test_svqabs_s8_z
20   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.sqabs.nxv16i8(<vscale x 16 x i8> zeroinitializer, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
21   // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
22   // overload-warning@+2 {{implicit declaration of function 'svqabs_z'}}
23   // expected-warning@+1 {{implicit declaration of function 'svqabs_s8_z'}}
24   return SVE_ACLE_FUNC(svqabs,_s8,_z,)(pg, op);
25 }
26 
test_svqabs_s16_z(svbool_t pg,svint16_t op)27 svint16_t test_svqabs_s16_z(svbool_t pg, svint16_t op)
28 {
29   // CHECK-LABEL: test_svqabs_s16_z
30   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
31   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.sqabs.nxv8i16(<vscale x 8 x i16> zeroinitializer, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
32   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
33   // overload-warning@+2 {{implicit declaration of function 'svqabs_z'}}
34   // expected-warning@+1 {{implicit declaration of function 'svqabs_s16_z'}}
35   return SVE_ACLE_FUNC(svqabs,_s16,_z,)(pg, op);
36 }
37 
test_svqabs_s32_z(svbool_t pg,svint32_t op)38 svint32_t test_svqabs_s32_z(svbool_t pg, svint32_t op)
39 {
40   // CHECK-LABEL: test_svqabs_s32_z
41   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
42   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sqabs.nxv4i32(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
43   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
44   // overload-warning@+2 {{implicit declaration of function 'svqabs_z'}}
45   // expected-warning@+1 {{implicit declaration of function 'svqabs_s32_z'}}
46   return SVE_ACLE_FUNC(svqabs,_s32,_z,)(pg, op);
47 }
48 
test_svqabs_s64_z(svbool_t pg,svint64_t op)49 svint64_t test_svqabs_s64_z(svbool_t pg, svint64_t op)
50 {
51   // CHECK-LABEL: test_svqabs_s64_z
52   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
53   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sqabs.nxv2i64(<vscale x 2 x i64> zeroinitializer, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
54   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
55   // overload-warning@+2 {{implicit declaration of function 'svqabs_z'}}
56   // expected-warning@+1 {{implicit declaration of function 'svqabs_s64_z'}}
57   return SVE_ACLE_FUNC(svqabs,_s64,_z,)(pg, op);
58 }
59 
test_svqabs_s8_m(svint8_t inactive,svbool_t pg,svint8_t op)60 svint8_t test_svqabs_s8_m(svint8_t inactive, svbool_t pg, svint8_t op)
61 {
62   // CHECK-LABEL: test_svqabs_s8_m
63   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.sqabs.nxv16i8(<vscale x 16 x i8> %inactive, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
64   // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
65   // overload-warning@+2 {{implicit declaration of function 'svqabs_m'}}
66   // expected-warning@+1 {{implicit declaration of function 'svqabs_s8_m'}}
67   return SVE_ACLE_FUNC(svqabs,_s8,_m,)(inactive, pg, op);
68 }
69 
test_svqabs_s16_m(svint16_t inactive,svbool_t pg,svint16_t op)70 svint16_t test_svqabs_s16_m(svint16_t inactive, svbool_t pg, svint16_t op)
71 {
72   // CHECK-LABEL: test_svqabs_s16_m
73   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
74   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.sqabs.nxv8i16(<vscale x 8 x i16> %inactive, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
75   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
76   // overload-warning@+2 {{implicit declaration of function 'svqabs_m'}}
77   // expected-warning@+1 {{implicit declaration of function 'svqabs_s16_m'}}
78   return SVE_ACLE_FUNC(svqabs,_s16,_m,)(inactive, pg, op);
79 }
80 
test_svqabs_s32_m(svint32_t inactive,svbool_t pg,svint32_t op)81 svint32_t test_svqabs_s32_m(svint32_t inactive, svbool_t pg, svint32_t op)
82 {
83   // CHECK-LABEL: test_svqabs_s32_m
84   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
85   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sqabs.nxv4i32(<vscale x 4 x i32> %inactive, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
86   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
87   // overload-warning@+2 {{implicit declaration of function 'svqabs_m'}}
88   // expected-warning@+1 {{implicit declaration of function 'svqabs_s32_m'}}
89   return SVE_ACLE_FUNC(svqabs,_s32,_m,)(inactive, pg, op);
90 }
91 
test_svqabs_s64_m(svint64_t inactive,svbool_t pg,svint64_t op)92 svint64_t test_svqabs_s64_m(svint64_t inactive, svbool_t pg, svint64_t op)
93 {
94   // CHECK-LABEL: test_svqabs_s64_m
95   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
96   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sqabs.nxv2i64(<vscale x 2 x i64> %inactive, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
97   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
98   // overload-warning@+2 {{implicit declaration of function 'svqabs_m'}}
99   // expected-warning@+1 {{implicit declaration of function 'svqabs_s64_m'}}
100   return SVE_ACLE_FUNC(svqabs,_s64,_m,)(inactive, pg, op);
101 }
102 
test_svqabs_s8_x(svbool_t pg,svint8_t op)103 svint8_t test_svqabs_s8_x(svbool_t pg, svint8_t op)
104 {
105   // CHECK-LABEL: test_svqabs_s8_x
106   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.sqabs.nxv16i8(<vscale x 16 x i8> undef, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
107   // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
108   // overload-warning@+2 {{implicit declaration of function 'svqabs_x'}}
109   // expected-warning@+1 {{implicit declaration of function 'svqabs_s8_x'}}
110   return SVE_ACLE_FUNC(svqabs,_s8,_x,)(pg, op);
111 }
112 
test_svqabs_s16_x(svbool_t pg,svint16_t op)113 svint16_t test_svqabs_s16_x(svbool_t pg, svint16_t op)
114 {
115   // CHECK-LABEL: test_svqabs_s16_x
116   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
117   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.sqabs.nxv8i16(<vscale x 8 x i16> undef, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
118   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
119   // overload-warning@+2 {{implicit declaration of function 'svqabs_x'}}
120   // expected-warning@+1 {{implicit declaration of function 'svqabs_s16_x'}}
121   return SVE_ACLE_FUNC(svqabs,_s16,_x,)(pg, op);
122 }
123 
test_svqabs_s32_x(svbool_t pg,svint32_t op)124 svint32_t test_svqabs_s32_x(svbool_t pg, svint32_t op)
125 {
126   // CHECK-LABEL: test_svqabs_s32_x
127   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
128   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sqabs.nxv4i32(<vscale x 4 x i32> undef, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
129   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
130   // overload-warning@+2 {{implicit declaration of function 'svqabs_x'}}
131   // expected-warning@+1 {{implicit declaration of function 'svqabs_s32_x'}}
132   return SVE_ACLE_FUNC(svqabs,_s32,_x,)(pg, op);
133 }
134 
test_svqabs_s64_x(svbool_t pg,svint64_t op)135 svint64_t test_svqabs_s64_x(svbool_t pg, svint64_t op)
136 {
137   // CHECK-LABEL: test_svqabs_s64_x
138   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
139   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sqabs.nxv2i64(<vscale x 2 x i64> undef, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
140   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
141   // overload-warning@+2 {{implicit declaration of function 'svqabs_x'}}
142   // expected-warning@+1 {{implicit declaration of function 'svqabs_s64_x'}}
143   return SVE_ACLE_FUNC(svqabs,_s64,_x,)(pg, op);
144 }
145