• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 -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
4 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
5 // RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
6 
7 // If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
8 // ASM-NOT: warning
9 #include <arm_sve.h>
10 
11 #ifdef SVE_OVERLOADED_FORMS
12 // A simple used,unused... macro, long enough to represent any SVE builtin.
13 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
14 #else
15 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
16 #endif
17 
test_svextb_s16_z(svbool_t pg,svint16_t op)18 svint16_t test_svextb_s16_z(svbool_t pg, svint16_t op)
19 {
20   // CHECK-LABEL: test_svextb_s16_z
21   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
22   // 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)
23   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
24   return SVE_ACLE_FUNC(svextb,_s16,_z,)(pg, op);
25 }
26 
test_svextb_s32_z(svbool_t pg,svint32_t op)27 svint32_t test_svextb_s32_z(svbool_t pg, svint32_t op)
28 {
29   // CHECK-LABEL: test_svextb_s32_z
30   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
31   // 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)
32   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
33   return SVE_ACLE_FUNC(svextb,_s32,_z,)(pg, op);
34 }
35 
test_svextb_s64_z(svbool_t pg,svint64_t op)36 svint64_t test_svextb_s64_z(svbool_t pg, svint64_t op)
37 {
38   // CHECK-LABEL: test_svextb_s64_z
39   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
40   // 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)
41   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
42   return SVE_ACLE_FUNC(svextb,_s64,_z,)(pg, op);
43 }
44 
test_svextb_u16_z(svbool_t pg,svuint16_t op)45 svuint16_t test_svextb_u16_z(svbool_t pg, svuint16_t op)
46 {
47   // CHECK-LABEL: test_svextb_u16_z
48   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
49   // 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)
50   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
51   return SVE_ACLE_FUNC(svextb,_u16,_z,)(pg, op);
52 }
53 
test_svextb_u32_z(svbool_t pg,svuint32_t op)54 svuint32_t test_svextb_u32_z(svbool_t pg, svuint32_t op)
55 {
56   // CHECK-LABEL: test_svextb_u32_z
57   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
58   // 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)
59   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
60   return SVE_ACLE_FUNC(svextb,_u32,_z,)(pg, op);
61 }
62 
test_svextb_u64_z(svbool_t pg,svuint64_t op)63 svuint64_t test_svextb_u64_z(svbool_t pg, svuint64_t op)
64 {
65   // CHECK-LABEL: test_svextb_u64_z
66   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
67   // 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)
68   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
69   return SVE_ACLE_FUNC(svextb,_u64,_z,)(pg, op);
70 }
71 
test_svextb_s16_m(svint16_t inactive,svbool_t pg,svint16_t op)72 svint16_t test_svextb_s16_m(svint16_t inactive, svbool_t pg, svint16_t op)
73 {
74   // CHECK-LABEL: test_svextb_s16_m
75   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
76   // 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)
77   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
78   return SVE_ACLE_FUNC(svextb,_s16,_m,)(inactive, pg, op);
79 }
80 
test_svextb_s32_m(svint32_t inactive,svbool_t pg,svint32_t op)81 svint32_t test_svextb_s32_m(svint32_t inactive, svbool_t pg, svint32_t op)
82 {
83   // CHECK-LABEL: test_svextb_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.sxtb.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   return SVE_ACLE_FUNC(svextb,_s32,_m,)(inactive, pg, op);
88 }
89 
test_svextb_s64_m(svint64_t inactive,svbool_t pg,svint64_t op)90 svint64_t test_svextb_s64_m(svint64_t inactive, svbool_t pg, svint64_t op)
91 {
92   // CHECK-LABEL: test_svextb_s64_m
93   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
94   // 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)
95   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
96   return SVE_ACLE_FUNC(svextb,_s64,_m,)(inactive, pg, op);
97 }
98 
test_svextb_u16_m(svuint16_t inactive,svbool_t pg,svuint16_t op)99 svuint16_t test_svextb_u16_m(svuint16_t inactive, svbool_t pg, svuint16_t op)
100 {
101   // CHECK-LABEL: test_svextb_u16_m
102   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
103   // 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)
104   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
105   return SVE_ACLE_FUNC(svextb,_u16,_m,)(inactive, pg, op);
106 }
107 
test_svextb_u32_m(svuint32_t inactive,svbool_t pg,svuint32_t op)108 svuint32_t test_svextb_u32_m(svuint32_t inactive, svbool_t pg, svuint32_t op)
109 {
110   // CHECK-LABEL: test_svextb_u32_m
111   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
112   // 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)
113   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
114   return SVE_ACLE_FUNC(svextb,_u32,_m,)(inactive, pg, op);
115 }
116 
test_svextb_u64_m(svuint64_t inactive,svbool_t pg,svuint64_t op)117 svuint64_t test_svextb_u64_m(svuint64_t inactive, svbool_t pg, svuint64_t op)
118 {
119   // CHECK-LABEL: test_svextb_u64_m
120   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
121   // 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)
122   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
123   return SVE_ACLE_FUNC(svextb,_u64,_m,)(inactive, pg, op);
124 }
125 
test_svextb_s16_x(svbool_t pg,svint16_t op)126 svint16_t test_svextb_s16_x(svbool_t pg, svint16_t op)
127 {
128   // CHECK-LABEL: test_svextb_s16_x
129   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
130   // 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)
131   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
132   return SVE_ACLE_FUNC(svextb,_s16,_x,)(pg, op);
133 }
134 
test_svextb_s32_x(svbool_t pg,svint32_t op)135 svint32_t test_svextb_s32_x(svbool_t pg, svint32_t op)
136 {
137   // CHECK-LABEL: test_svextb_s32_x
138   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
139   // 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)
140   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
141   return SVE_ACLE_FUNC(svextb,_s32,_x,)(pg, op);
142 }
143 
test_svextb_s64_x(svbool_t pg,svint64_t op)144 svint64_t test_svextb_s64_x(svbool_t pg, svint64_t op)
145 {
146   // CHECK-LABEL: test_svextb_s64_x
147   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
148   // 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)
149   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
150   return SVE_ACLE_FUNC(svextb,_s64,_x,)(pg, op);
151 }
152 
test_svextb_u16_x(svbool_t pg,svuint16_t op)153 svuint16_t test_svextb_u16_x(svbool_t pg, svuint16_t op)
154 {
155   // CHECK-LABEL: test_svextb_u16_x
156   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
157   // 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)
158   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
159   return SVE_ACLE_FUNC(svextb,_u16,_x,)(pg, op);
160 }
161 
test_svextb_u32_x(svbool_t pg,svuint32_t op)162 svuint32_t test_svextb_u32_x(svbool_t pg, svuint32_t op)
163 {
164   // CHECK-LABEL: test_svextb_u32_x
165   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
166   // 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)
167   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
168   return SVE_ACLE_FUNC(svextb,_u32,_x,)(pg, op);
169 }
170 
test_svextb_u64_x(svbool_t pg,svuint64_t op)171 svuint64_t test_svextb_u64_x(svbool_t pg, svuint64_t op)
172 {
173   // CHECK-LABEL: test_svextb_u64_x
174   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
175   // 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)
176   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
177   return SVE_ACLE_FUNC(svextb,_u64,_x,)(pg, op);
178 }
179