1; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s 2>%t | FileCheck %s
2; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t
3
4; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it.
5; WARN-NOT: warning
6
7;
8; Converting to svbool_t (<vscale x 16 x i1>)
9;
10
11define <vscale x 16 x i1> @reinterpret_bool_from_b(<vscale x 16 x i1> %pg) {
12; CHECK-LABEL: reinterpret_bool_from_b:
13; CHECK: ret
14  %out = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv16i1(<vscale x 16 x i1> %pg)
15  ret <vscale x 16 x i1> %out
16}
17
18define <vscale x 16 x i1> @reinterpret_bool_from_h(<vscale x 8 x i1> %pg) {
19; CHECK-LABEL: reinterpret_bool_from_h:
20; CHECK: ptrue p1.h
21; CHECK-NEXT: ptrue p2.b
22; CHECK-NEXT: and p0.b, p2/z, p0.b, p1.b
23; CHECK-NEXT: ret
24  %out = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %pg)
25  ret <vscale x 16 x i1> %out
26}
27
28define <vscale x 16 x i1> @reinterpret_bool_from_s(<vscale x 4 x i1> %pg) {
29; CHECK-LABEL: reinterpret_bool_from_s:
30; CHECK: ptrue p1.s
31; CHECK-NEXT: ptrue p2.b
32; CHECK-NEXT: and p0.b, p2/z, p0.b, p1.b
33; CHECK-NEXT: ret
34  %out = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %pg)
35  ret <vscale x 16 x i1> %out
36}
37
38define <vscale x 16 x i1> @reinterpret_bool_from_d(<vscale x 2 x i1> %pg) {
39; CHECK-LABEL: reinterpret_bool_from_d:
40; CHECK: ptrue p1.d
41; CHECK-NEXT: ptrue p2.b
42; CHECK-NEXT: and p0.b, p2/z, p0.b, p1.b
43; CHECK-NEXT: ret
44  %out = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %pg)
45  ret <vscale x 16 x i1> %out
46}
47
48;
49; Converting from svbool_t
50;
51
52define <vscale x 16 x i1> @reinterpret_bool_to_b(<vscale x 16 x i1> %pg) {
53; CHECK-LABEL: reinterpret_bool_to_b:
54; CHECK: ret
55  %out = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv16i1(<vscale x 16 x i1> %pg)
56  ret <vscale x 16 x i1> %out
57}
58
59define <vscale x 8 x i1> @reinterpret_bool_to_h(<vscale x 16 x i1> %pg) {
60; CHECK-LABEL: reinterpret_bool_to_h:
61; CHECK: ret
62  %out = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
63  ret <vscale x 8 x i1> %out
64}
65
66define <vscale x 4 x i1> @reinterpret_bool_to_s(<vscale x 16 x i1> %pg) {
67; CHECK-LABEL: reinterpret_bool_to_s:
68; CHECK: ret
69  %out = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
70  ret <vscale x 4 x i1> %out
71}
72
73define <vscale x 2 x i1> @reinterpret_bool_to_d(<vscale x 16 x i1> %pg) {
74; CHECK-LABEL: reinterpret_bool_to_d:
75; CHECK: ret
76  %out = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
77  ret <vscale x 2 x i1> %out
78}
79
80declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv16i1(<vscale x 16 x i1>)
81declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1>)
82declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1>)
83declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1>)
84
85declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv16i1(<vscale x 16 x i1>)
86declare <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1>)
87declare <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1>)
88declare <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1>)
89