1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -verify-machineinstrs < %s | FileCheck %s
4 ; Test that the select returns %true, because the predicate is all active.
5 define <vscale x 4 x i32> @select_ptrue_fold_all_active(<vscale x 4 x i32> %false, <vscale x 4 x i32> %true) {
6 ; CHECK-LABEL: select_ptrue_fold_all_active:
8 ; CHECK-NEXT: mov z0.d, z1.d
10 %p = call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 31)
11 %res = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %true, <vscale x 4 x i32> %false
12 ret <vscale x 4 x i32> %res
15 ; Test that the select returns %true, because the predicate is all active for vscale_range(2, 2)
16 define <vscale x 4 x i32> @select_ptrue_fold_vl8(<vscale x 4 x i32> %false, <vscale x 4 x i32> %true) vscale_range(2, 2) {
17 ; CHECK-LABEL: select_ptrue_fold_vl8:
19 ; CHECK-NEXT: mov z0.d, z1.d
21 %p = call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 8)
22 %res = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %true, <vscale x 4 x i32> %false
23 ret <vscale x 4 x i32> %res
26 define <vscale x 16 x i8> @select_ptrue_fold_all_inactive(<vscale x 16 x i8> %true, <vscale x 16 x i8> %false) {
27 ; CHECK-LABEL: select_ptrue_fold_all_inactive:
29 ; CHECK-NEXT: mov z0.d, z1.d
31 %p = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv16i1(<vscale x 16 x i1> zeroinitializer)
32 %res = select <vscale x 16 x i1> %p, <vscale x 16 x i8> %true, <vscale x 16 x i8> %false
33 ret <vscale x 16 x i8> %res
36 define <vscale x 4 x i32> @select_ptrue_fold_all_inactive_reinterpret(<vscale x 4 x i32> %true, <vscale x 4 x i32> %false) {
37 ; CHECK-LABEL: select_ptrue_fold_all_inactive_reinterpret:
39 ; CHECK-NEXT: mov z0.d, z1.d
41 %p = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> zeroinitializer)
42 %res = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %true, <vscale x 4 x i32> %false
43 ret <vscale x 4 x i32> %res
46 ; Test that the select remains, because predicate is not all active (only half lanes are set for vscale_range(2, 2))
47 define <vscale x 4 x i32> @select_ptrue_no_fold_vl4(<vscale x 4 x i32> %true, <vscale x 4 x i32> %false) vscale_range(2, 2) {
48 ; CHECK-LABEL: select_ptrue_no_fold_vl4:
50 ; CHECK-NEXT: ptrue p0.s, vl4
51 ; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s
53 %p = call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 4)
54 %res = select <vscale x 4 x i1> %p, <vscale x 4 x i32> %true, <vscale x 4 x i32> %false
55 ret <vscale x 4 x i32> %res
58 declare <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32)
59 declare <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1>)
60 declare <vscale x 16 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv16i1(<vscale x 16 x i1>)