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 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -o - %s >/dev/null
5 #include <arm_sve.h>
6 
test_svptrue_b8()7 svbool_t test_svptrue_b8()
8 {
9   // CHECK-LABEL: test_svptrue_b8
10   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 31)
11   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
12   return svptrue_b8();
13 }
14 
test_svptrue_b16()15 svbool_t test_svptrue_b16()
16 {
17   // CHECK-LABEL: test_svptrue_b16
18   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 31)
19   // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
20   // CHECK: ret <vscale x 16 x i1> %[[CAST]]
21   return svptrue_b16();
22 }
23 
test_svptrue_b32()24 svbool_t test_svptrue_b32()
25 {
26   // CHECK-LABEL: test_svptrue_b32
27   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 31)
28   // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %[[INTRINSIC]])
29   // CHECK: ret <vscale x 16 x i1> %[[CAST]]
30   return svptrue_b32();
31 }
32 
test_svptrue_b64()33 svbool_t test_svptrue_b64()
34 {
35   // CHECK-LABEL: test_svptrue_b64
36   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32 31)
37   // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %[[INTRINSIC]])
38   // CHECK: ret <vscale x 16 x i1> %[[CAST]]
39   return svptrue_b64();
40 }
41 
test_svptrue_pat_b8()42 svbool_t test_svptrue_pat_b8()
43 {
44   // CHECK-LABEL: test_svptrue_pat_b8
45   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 0)
46   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
47   return svptrue_pat_b8(SV_POW2);
48 }
49 
test_svptrue_pat_b8_1()50 svbool_t test_svptrue_pat_b8_1()
51 {
52   // CHECK-LABEL: test_svptrue_pat_b8_1
53   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 1)
54   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
55   return svptrue_pat_b8(SV_VL1);
56 }
57 
test_svptrue_pat_b8_2()58 svbool_t test_svptrue_pat_b8_2()
59 {
60   // CHECK-LABEL: test_svptrue_pat_b8_2
61   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 2)
62   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
63   return svptrue_pat_b8(SV_VL2);
64 }
65 
test_svptrue_pat_b8_3()66 svbool_t test_svptrue_pat_b8_3()
67 {
68   // CHECK-LABEL: test_svptrue_pat_b8_3
69   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 3)
70   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
71   return svptrue_pat_b8(SV_VL3);
72 }
73 
test_svptrue_pat_b8_4()74 svbool_t test_svptrue_pat_b8_4()
75 {
76   // CHECK-LABEL: test_svptrue_pat_b8_4
77   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 4)
78   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
79   return svptrue_pat_b8(SV_VL4);
80 }
81 
test_svptrue_pat_b8_5()82 svbool_t test_svptrue_pat_b8_5()
83 {
84   // CHECK-LABEL: test_svptrue_pat_b8_5
85   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 5)
86   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
87   return svptrue_pat_b8(SV_VL5);
88 }
89 
test_svptrue_pat_b8_6()90 svbool_t test_svptrue_pat_b8_6()
91 {
92   // CHECK-LABEL: test_svptrue_pat_b8_6
93   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 6)
94   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
95   return svptrue_pat_b8(SV_VL6);
96 }
97 
test_svptrue_pat_b8_7()98 svbool_t test_svptrue_pat_b8_7()
99 {
100   // CHECK-LABEL: test_svptrue_pat_b8_7
101   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 7)
102   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
103   return svptrue_pat_b8(SV_VL7);
104 }
105 
test_svptrue_pat_b8_8()106 svbool_t test_svptrue_pat_b8_8()
107 {
108   // CHECK-LABEL: test_svptrue_pat_b8_8
109   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 8)
110   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
111   return svptrue_pat_b8(SV_VL8);
112 }
113 
test_svptrue_pat_b8_9()114 svbool_t test_svptrue_pat_b8_9()
115 {
116   // CHECK-LABEL: test_svptrue_pat_b8_9
117   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 9)
118   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
119   return svptrue_pat_b8(SV_VL16);
120 }
121 
test_svptrue_pat_b8_10()122 svbool_t test_svptrue_pat_b8_10()
123 {
124   // CHECK-LABEL: test_svptrue_pat_b8_10
125   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 10)
126   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
127   return svptrue_pat_b8(SV_VL32);
128 }
129 
test_svptrue_pat_b8_11()130 svbool_t test_svptrue_pat_b8_11()
131 {
132   // CHECK-LABEL: test_svptrue_pat_b8_11
133   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 11)
134   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
135   return svptrue_pat_b8(SV_VL64);
136 }
137 
test_svptrue_pat_b8_12()138 svbool_t test_svptrue_pat_b8_12()
139 {
140   // CHECK-LABEL: test_svptrue_pat_b8_12
141   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 12)
142   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
143   return svptrue_pat_b8(SV_VL128);
144 }
145 
test_svptrue_pat_b8_13()146 svbool_t test_svptrue_pat_b8_13()
147 {
148   // CHECK-LABEL: test_svptrue_pat_b8_13
149   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 13)
150   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
151   return svptrue_pat_b8(SV_VL256);
152 }
153 
test_svptrue_pat_b8_14()154 svbool_t test_svptrue_pat_b8_14()
155 {
156   // CHECK-LABEL: test_svptrue_pat_b8_14
157   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 29)
158   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
159   return svptrue_pat_b8(SV_MUL4);
160 }
161 
test_svptrue_pat_b8_15()162 svbool_t test_svptrue_pat_b8_15()
163 {
164   // CHECK-LABEL: test_svptrue_pat_b8_15
165   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 30)
166   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
167   return svptrue_pat_b8(SV_MUL3);
168 }
169 
test_svptrue_pat_b8_16()170 svbool_t test_svptrue_pat_b8_16()
171 {
172   // CHECK-LABEL: test_svptrue_pat_b8_16
173   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 31)
174   // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
175   return svptrue_pat_b8(SV_ALL);
176 }
177 
test_svptrue_pat_b16()178 svbool_t test_svptrue_pat_b16()
179 {
180   // CHECK-LABEL: test_svptrue_pat_b16
181   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 0)
182   // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
183   // CHECK: ret <vscale x 16 x i1> %[[CAST]]
184   return svptrue_pat_b16(SV_POW2);
185 }
186 
test_svptrue_pat_b32()187 svbool_t test_svptrue_pat_b32()
188 {
189   // CHECK-LABEL: test_svptrue_pat_b32
190   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 1)
191   // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %[[INTRINSIC]])
192   // CHECK: ret <vscale x 16 x i1> %[[CAST]]
193   return svptrue_pat_b32(SV_VL1);
194 }
195 
test_svptrue_pat_b64()196 svbool_t test_svptrue_pat_b64()
197 {
198   // CHECK-LABEL: test_svptrue_pat_b64
199   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32 2)
200   // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %[[INTRINSIC]])
201   // CHECK: ret <vscale x 16 x i1> %[[CAST]]
202   return svptrue_pat_b64(SV_VL2);
203 }
204