1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -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
4 // RUN: %clang_cc1 -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
5 // RUN: %clang_cc1 -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
6 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null
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_svextb_s16_z(svbool_t pg,svint16_t op)16 svint16_t test_svextb_s16_z(svbool_t pg, svint16_t op)
17 {
18 // CHECK-LABEL: test_svextb_s16_z
19 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
20 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.sxtb.nxv8i16(<vscale x 8 x i16> zeroinitializer, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
21 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
22 return SVE_ACLE_FUNC(svextb,_s16,_z,)(pg, op);
23 }
24
test_svextb_s32_z(svbool_t pg,svint32_t op)25 svint32_t test_svextb_s32_z(svbool_t pg, svint32_t op)
26 {
27 // CHECK-LABEL: test_svextb_s32_z
28 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
29 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sxtb.nxv4i32(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
30 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
31 return SVE_ACLE_FUNC(svextb,_s32,_z,)(pg, op);
32 }
33
test_svextb_s64_z(svbool_t pg,svint64_t op)34 svint64_t test_svextb_s64_z(svbool_t pg, svint64_t op)
35 {
36 // CHECK-LABEL: test_svextb_s64_z
37 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
38 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtb.nxv2i64(<vscale x 2 x i64> zeroinitializer, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
39 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
40 return SVE_ACLE_FUNC(svextb,_s64,_z,)(pg, op);
41 }
42
test_svextb_u16_z(svbool_t pg,svuint16_t op)43 svuint16_t test_svextb_u16_z(svbool_t pg, svuint16_t op)
44 {
45 // CHECK-LABEL: test_svextb_u16_z
46 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
47 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.uxtb.nxv8i16(<vscale x 8 x i16> zeroinitializer, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
48 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
49 return SVE_ACLE_FUNC(svextb,_u16,_z,)(pg, op);
50 }
51
test_svextb_u32_z(svbool_t pg,svuint32_t op)52 svuint32_t test_svextb_u32_z(svbool_t pg, svuint32_t op)
53 {
54 // CHECK-LABEL: test_svextb_u32_z
55 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
56 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.uxtb.nxv4i32(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
57 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
58 return SVE_ACLE_FUNC(svextb,_u32,_z,)(pg, op);
59 }
60
test_svextb_u64_z(svbool_t pg,svuint64_t op)61 svuint64_t test_svextb_u64_z(svbool_t pg, svuint64_t op)
62 {
63 // CHECK-LABEL: test_svextb_u64_z
64 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
65 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtb.nxv2i64(<vscale x 2 x i64> zeroinitializer, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
66 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
67 return SVE_ACLE_FUNC(svextb,_u64,_z,)(pg, op);
68 }
69
test_svextb_s16_m(svint16_t inactive,svbool_t pg,svint16_t op)70 svint16_t test_svextb_s16_m(svint16_t inactive, svbool_t pg, svint16_t op)
71 {
72 // CHECK-LABEL: test_svextb_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.sxtb.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 return SVE_ACLE_FUNC(svextb,_s16,_m,)(inactive, pg, op);
77 }
78
test_svextb_s32_m(svint32_t inactive,svbool_t pg,svint32_t op)79 svint32_t test_svextb_s32_m(svint32_t inactive, svbool_t pg, svint32_t op)
80 {
81 // CHECK-LABEL: test_svextb_s32_m
82 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
83 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sxtb.nxv4i32(<vscale x 4 x i32> %inactive, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
84 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
85 return SVE_ACLE_FUNC(svextb,_s32,_m,)(inactive, pg, op);
86 }
87
test_svextb_s64_m(svint64_t inactive,svbool_t pg,svint64_t op)88 svint64_t test_svextb_s64_m(svint64_t inactive, svbool_t pg, svint64_t op)
89 {
90 // CHECK-LABEL: test_svextb_s64_m
91 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
92 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtb.nxv2i64(<vscale x 2 x i64> %inactive, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
93 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
94 return SVE_ACLE_FUNC(svextb,_s64,_m,)(inactive, pg, op);
95 }
96
test_svextb_u16_m(svuint16_t inactive,svbool_t pg,svuint16_t op)97 svuint16_t test_svextb_u16_m(svuint16_t inactive, svbool_t pg, svuint16_t op)
98 {
99 // CHECK-LABEL: test_svextb_u16_m
100 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
101 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.uxtb.nxv8i16(<vscale x 8 x i16> %inactive, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
102 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
103 return SVE_ACLE_FUNC(svextb,_u16,_m,)(inactive, pg, op);
104 }
105
test_svextb_u32_m(svuint32_t inactive,svbool_t pg,svuint32_t op)106 svuint32_t test_svextb_u32_m(svuint32_t inactive, svbool_t pg, svuint32_t op)
107 {
108 // CHECK-LABEL: test_svextb_u32_m
109 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
110 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.uxtb.nxv4i32(<vscale x 4 x i32> %inactive, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
111 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
112 return SVE_ACLE_FUNC(svextb,_u32,_m,)(inactive, pg, op);
113 }
114
test_svextb_u64_m(svuint64_t inactive,svbool_t pg,svuint64_t op)115 svuint64_t test_svextb_u64_m(svuint64_t inactive, svbool_t pg, svuint64_t op)
116 {
117 // CHECK-LABEL: test_svextb_u64_m
118 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
119 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtb.nxv2i64(<vscale x 2 x i64> %inactive, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
120 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
121 return SVE_ACLE_FUNC(svextb,_u64,_m,)(inactive, pg, op);
122 }
123
test_svextb_s16_x(svbool_t pg,svint16_t op)124 svint16_t test_svextb_s16_x(svbool_t pg, svint16_t op)
125 {
126 // CHECK-LABEL: test_svextb_s16_x
127 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
128 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.sxtb.nxv8i16(<vscale x 8 x i16> undef, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
129 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
130 return SVE_ACLE_FUNC(svextb,_s16,_x,)(pg, op);
131 }
132
test_svextb_s32_x(svbool_t pg,svint32_t op)133 svint32_t test_svextb_s32_x(svbool_t pg, svint32_t op)
134 {
135 // CHECK-LABEL: test_svextb_s32_x
136 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
137 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sxtb.nxv4i32(<vscale x 4 x i32> undef, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
138 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
139 return SVE_ACLE_FUNC(svextb,_s32,_x,)(pg, op);
140 }
141
test_svextb_s64_x(svbool_t pg,svint64_t op)142 svint64_t test_svextb_s64_x(svbool_t pg, svint64_t op)
143 {
144 // CHECK-LABEL: test_svextb_s64_x
145 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
146 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtb.nxv2i64(<vscale x 2 x i64> undef, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
147 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
148 return SVE_ACLE_FUNC(svextb,_s64,_x,)(pg, op);
149 }
150
test_svextb_u16_x(svbool_t pg,svuint16_t op)151 svuint16_t test_svextb_u16_x(svbool_t pg, svuint16_t op)
152 {
153 // CHECK-LABEL: test_svextb_u16_x
154 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
155 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.uxtb.nxv8i16(<vscale x 8 x i16> undef, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
156 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
157 return SVE_ACLE_FUNC(svextb,_u16,_x,)(pg, op);
158 }
159
test_svextb_u32_x(svbool_t pg,svuint32_t op)160 svuint32_t test_svextb_u32_x(svbool_t pg, svuint32_t op)
161 {
162 // CHECK-LABEL: test_svextb_u32_x
163 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
164 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.uxtb.nxv4i32(<vscale x 4 x i32> undef, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
165 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
166 return SVE_ACLE_FUNC(svextb,_u32,_x,)(pg, op);
167 }
168
test_svextb_u64_x(svbool_t pg,svuint64_t op)169 svuint64_t test_svextb_u64_x(svbool_t pg, svuint64_t op)
170 {
171 // CHECK-LABEL: test_svextb_u64_x
172 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
173 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtb.nxv2i64(<vscale x 2 x i64> undef, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
174 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
175 return SVE_ACLE_FUNC(svextb,_u64,_x,)(pg, op);
176 }
177