1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
5 ; Converting to svbool_t (<vscale x 16 x i1>)
8 define <vscale x 16 x i1> @reinterpret_bool_from_b(<vscale x 16 x i1> %pg) {
9 ; CHECK-LABEL: reinterpret_bool_from_b:
12 %out = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv16i1(<vscale x 16 x i1> %pg)
13 ret <vscale x 16 x i1> %out
16 define <vscale x 16 x i1> @reinterpret_bool_from_h(<vscale x 8 x i1> %pg) {
17 ; CHECK-LABEL: reinterpret_bool_from_h:
19 ; CHECK-NEXT: ptrue p1.h
20 ; CHECK-NEXT: ptrue p2.b
21 ; CHECK-NEXT: and p0.b, p2/z, p0.b, p1.b
23 %out = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %pg)
24 ret <vscale x 16 x i1> %out
27 define <vscale x 16 x i1> @reinterpret_bool_from_s(<vscale x 4 x i1> %pg) {
28 ; CHECK-LABEL: reinterpret_bool_from_s:
30 ; CHECK-NEXT: ptrue p1.s
31 ; CHECK-NEXT: ptrue p2.b
32 ; CHECK-NEXT: and p0.b, p2/z, p0.b, p1.b
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
38 define <vscale x 16 x i1> @reinterpret_bool_from_d(<vscale x 2 x i1> %pg) {
39 ; CHECK-LABEL: reinterpret_bool_from_d:
41 ; CHECK-NEXT: ptrue p1.d
42 ; CHECK-NEXT: ptrue p2.b
43 ; CHECK-NEXT: and p0.b, p2/z, p0.b, p1.b
45 %out = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %pg)
46 ret <vscale x 16 x i1> %out
50 ; Converting from svbool_t
53 define <vscale x 16 x i1> @reinterpret_bool_to_b(<vscale x 16 x i1> %pg) {
54 ; CHECK-LABEL: reinterpret_bool_to_b:
57 %out = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv16i1(<vscale x 16 x i1> %pg)
58 ret <vscale x 16 x i1> %out
61 define <vscale x 8 x i1> @reinterpret_bool_to_h(<vscale x 16 x i1> %pg) {
62 ; CHECK-LABEL: reinterpret_bool_to_h:
65 %out = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
66 ret <vscale x 8 x i1> %out
69 define <vscale x 4 x i1> @reinterpret_bool_to_s(<vscale x 16 x i1> %pg) {
70 ; CHECK-LABEL: reinterpret_bool_to_s:
73 %out = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
74 ret <vscale x 4 x i1> %out
77 define <vscale x 2 x i1> @reinterpret_bool_to_d(<vscale x 16 x i1> %pg) {
78 ; CHECK-LABEL: reinterpret_bool_to_d:
81 %out = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
82 ret <vscale x 2 x i1> %out
85 ; Reinterpreting a ptrue should not introduce an `and` instruction.
86 define <vscale x 16 x i1> @reinterpret_ptrue() {
87 ; CHECK-LABEL: reinterpret_ptrue:
89 ; CHECK-NEXT: ptrue p0.h
91 %in = tail call <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 31)
92 %out = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %in)
93 ret <vscale x 16 x i1> %out
96 ; Reinterpreting a comparison not introduce an `and` instruction.
97 define <vscale x 16 x i1> @reinterpret_cmpgt(<vscale x 8 x i1> %p, <vscale x 8 x i16> %a, <vscale x 8 x i16> %b) {
98 ; CHECK-LABEL: reinterpret_cmpgt:
100 ; CHECK-NEXT: cmpgt p0.h, p0/z, z0.h, z1.h
102 %1 = tail call <vscale x 8 x i1> @llvm.aarch64.sve.cmpgt.nxv8i16(<vscale x 8 x i1> %p, <vscale x 8 x i16> %a, <vscale x 8 x i16> %b)
103 %2 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %1)
104 ret <vscale x 16 x i1> %2
107 declare <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 immarg)
108 declare <vscale x 8 x i1> @llvm.aarch64.sve.cmpgt.nxv8i16(<vscale x 8 x i1>, <vscale x 8 x i16>, <vscale x 8 x i16>)
110 declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv16i1(<vscale x 16 x i1>)
111 declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1>)
112 declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1>)
113 declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1>)
115 declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv16i1(<vscale x 16 x i1>)
116 declare <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1>)
117 declare <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1>)
118 declare <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1>)