1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-none-linux-gnu -mattr=+neon | FileCheck %s --check-prefix=CHECK
4 declare <8 x i8> @llvm.cttz.v8i8(<8 x i8>, i1)
5 declare <4 x i16> @llvm.cttz.v4i16(<4 x i16>, i1)
6 declare <2 x i32> @llvm.cttz.v2i32(<2 x i32>, i1)
7 declare <1 x i64> @llvm.cttz.v1i64(<1 x i64>, i1)
9 declare <16 x i8> @llvm.cttz.v16i8(<16 x i8>, i1)
10 declare <8 x i16> @llvm.cttz.v8i16(<8 x i16>, i1)
11 declare <4 x i32> @llvm.cttz.v4i32(<4 x i32>, i1)
12 declare <2 x i64> @llvm.cttz.v2i64(<2 x i64>, i1)
14 define <8 x i8> @cttz_v8i8(<8 x i8> %a) nounwind {
15 ; CHECK-LABEL: cttz_v8i8:
17 ; CHECK-NEXT: movi v1.8b, #1
18 ; CHECK-NEXT: sub v1.8b, v0.8b, v1.8b
19 ; CHECK-NEXT: bic v0.8b, v1.8b, v0.8b
20 ; CHECK-NEXT: cnt v0.8b, v0.8b
22 %b = call <8 x i8> @llvm.cttz.v8i8(<8 x i8> %a, i1 true)
26 define <4 x i16> @cttz_v4i16(<4 x i16> %a) nounwind {
27 ; CHECK-LABEL: cttz_v4i16:
29 ; CHECK-NEXT: movi v1.4h, #1
30 ; CHECK-NEXT: sub v1.4h, v0.4h, v1.4h
31 ; CHECK-NEXT: bic v0.8b, v1.8b, v0.8b
32 ; CHECK-NEXT: movi v1.4h, #16
33 ; CHECK-NEXT: clz v0.4h, v0.4h
34 ; CHECK-NEXT: sub v0.4h, v1.4h, v0.4h
36 %b = call <4 x i16> @llvm.cttz.v4i16(<4 x i16> %a, i1 true)
40 define <2 x i32> @cttz_v2i32(<2 x i32> %a) nounwind {
41 ; CHECK-LABEL: cttz_v2i32:
43 ; CHECK-NEXT: movi v1.2s, #1
44 ; CHECK-NEXT: sub v1.2s, v0.2s, v1.2s
45 ; CHECK-NEXT: bic v0.8b, v1.8b, v0.8b
46 ; CHECK-NEXT: movi v1.2s, #32
47 ; CHECK-NEXT: clz v0.2s, v0.2s
48 ; CHECK-NEXT: sub v0.2s, v1.2s, v0.2s
50 %b = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> %a, i1 true)
54 define <1 x i64> @cttz_v1i64(<1 x i64> %a) nounwind {
55 ; CHECK-LABEL: cttz_v1i64:
57 ; CHECK-NEXT: mov w8, #1 // =0x1
58 ; CHECK-NEXT: fmov d1, x8
59 ; CHECK-NEXT: sub d1, d0, d1
60 ; CHECK-NEXT: bic v0.8b, v1.8b, v0.8b
61 ; CHECK-NEXT: cnt v0.8b, v0.8b
62 ; CHECK-NEXT: uaddlp v0.4h, v0.8b
63 ; CHECK-NEXT: uaddlp v0.2s, v0.4h
64 ; CHECK-NEXT: uaddlp v0.1d, v0.2s
66 %b = call <1 x i64> @llvm.cttz.v1i64(<1 x i64> %a, i1 true)
70 define <16 x i8> @cttz_v16i8(<16 x i8> %a) nounwind {
71 ; CHECK-LABEL: cttz_v16i8:
73 ; CHECK-NEXT: movi v1.16b, #1
74 ; CHECK-NEXT: sub v1.16b, v0.16b, v1.16b
75 ; CHECK-NEXT: bic v0.16b, v1.16b, v0.16b
76 ; CHECK-NEXT: cnt v0.16b, v0.16b
78 %b = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 true)
82 define <8 x i16> @cttz_v8i16(<8 x i16> %a) nounwind {
83 ; CHECK-LABEL: cttz_v8i16:
85 ; CHECK-NEXT: movi v1.8h, #1
86 ; CHECK-NEXT: sub v1.8h, v0.8h, v1.8h
87 ; CHECK-NEXT: bic v0.16b, v1.16b, v0.16b
88 ; CHECK-NEXT: movi v1.8h, #16
89 ; CHECK-NEXT: clz v0.8h, v0.8h
90 ; CHECK-NEXT: sub v0.8h, v1.8h, v0.8h
92 %b = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 true)
96 define <4 x i32> @cttz_v4i32(<4 x i32> %a) nounwind {
97 ; CHECK-LABEL: cttz_v4i32:
99 ; CHECK-NEXT: movi v1.4s, #1
100 ; CHECK-NEXT: sub v1.4s, v0.4s, v1.4s
101 ; CHECK-NEXT: bic v0.16b, v1.16b, v0.16b
102 ; CHECK-NEXT: movi v1.4s, #32
103 ; CHECK-NEXT: clz v0.4s, v0.4s
104 ; CHECK-NEXT: sub v0.4s, v1.4s, v0.4s
106 %b = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 true)
110 define <2 x i64> @cttz_v2i64(<2 x i64> %a) nounwind {
111 ; CHECK-LABEL: cttz_v2i64:
113 ; CHECK-NEXT: mov w8, #1 // =0x1
114 ; CHECK-NEXT: dup v1.2d, x8
115 ; CHECK-NEXT: sub v1.2d, v0.2d, v1.2d
116 ; CHECK-NEXT: bic v0.16b, v1.16b, v0.16b
117 ; CHECK-NEXT: cnt v0.16b, v0.16b
118 ; CHECK-NEXT: uaddlp v0.8h, v0.16b
119 ; CHECK-NEXT: uaddlp v0.4s, v0.8h
120 ; CHECK-NEXT: uaddlp v0.2d, v0.4s
122 %b = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true)