1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch64 --mattr=+lasx < %s | FileCheck %s
4 define void @ctpop_v32i8(ptr %src, ptr %dst) nounwind {
5 ; CHECK-LABEL: ctpop_v32i8:
7 ; CHECK-NEXT: xvld $xr0, $a0, 0
8 ; CHECK-NEXT: xvpcnt.b $xr0, $xr0
9 ; CHECK-NEXT: xvst $xr0, $a1, 0
11 %v = load <32 x i8>, ptr %src
12 %res = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %v)
13 store <32 x i8> %res, ptr %dst
17 define void @ctpop_v16i16(ptr %src, ptr %dst) nounwind {
18 ; CHECK-LABEL: ctpop_v16i16:
20 ; CHECK-NEXT: xvld $xr0, $a0, 0
21 ; CHECK-NEXT: xvpcnt.h $xr0, $xr0
22 ; CHECK-NEXT: xvst $xr0, $a1, 0
24 %v = load <16 x i16>, ptr %src
25 %res = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %v)
26 store <16 x i16> %res, ptr %dst
30 define void @ctpop_v8i32(ptr %src, ptr %dst) nounwind {
31 ; CHECK-LABEL: ctpop_v8i32:
33 ; CHECK-NEXT: xvld $xr0, $a0, 0
34 ; CHECK-NEXT: xvpcnt.w $xr0, $xr0
35 ; CHECK-NEXT: xvst $xr0, $a1, 0
37 %v = load <8 x i32>, ptr %src
38 %res = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %v)
39 store <8 x i32> %res, ptr %dst
43 define void @ctpop_v4i64(ptr %src, ptr %dst) nounwind {
44 ; CHECK-LABEL: ctpop_v4i64:
46 ; CHECK-NEXT: xvld $xr0, $a0, 0
47 ; CHECK-NEXT: xvpcnt.d $xr0, $xr0
48 ; CHECK-NEXT: xvst $xr0, $a1, 0
50 %v = load <4 x i64>, ptr %src
51 %res = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %v)
52 store <4 x i64> %res, ptr %dst
56 define void @ctlz_v32i8(ptr %src, ptr %dst) nounwind {
57 ; CHECK-LABEL: ctlz_v32i8:
59 ; CHECK-NEXT: xvld $xr0, $a0, 0
60 ; CHECK-NEXT: xvclz.b $xr0, $xr0
61 ; CHECK-NEXT: xvst $xr0, $a1, 0
63 %v = load <32 x i8>, ptr %src
64 %res = call <32 x i8> @llvm.ctlz.v32i8(<32 x i8> %v, i1 false)
65 store <32 x i8> %res, ptr %dst
69 define void @ctlz_v16i16(ptr %src, ptr %dst) nounwind {
70 ; CHECK-LABEL: ctlz_v16i16:
72 ; CHECK-NEXT: xvld $xr0, $a0, 0
73 ; CHECK-NEXT: xvclz.h $xr0, $xr0
74 ; CHECK-NEXT: xvst $xr0, $a1, 0
76 %v = load <16 x i16>, ptr %src
77 %res = call <16 x i16> @llvm.ctlz.v16i16(<16 x i16> %v, i1 false)
78 store <16 x i16> %res, ptr %dst
82 define void @ctlz_v8i32(ptr %src, ptr %dst) nounwind {
83 ; CHECK-LABEL: ctlz_v8i32:
85 ; CHECK-NEXT: xvld $xr0, $a0, 0
86 ; CHECK-NEXT: xvclz.w $xr0, $xr0
87 ; CHECK-NEXT: xvst $xr0, $a1, 0
89 %v = load <8 x i32>, ptr %src
90 %res = call <8 x i32> @llvm.ctlz.v8i32(<8 x i32> %v, i1 false)
91 store <8 x i32> %res, ptr %dst
95 define void @ctlz_v4i64(ptr %src, ptr %dst) nounwind {
96 ; CHECK-LABEL: ctlz_v4i64:
98 ; CHECK-NEXT: xvld $xr0, $a0, 0
99 ; CHECK-NEXT: xvclz.d $xr0, $xr0
100 ; CHECK-NEXT: xvst $xr0, $a1, 0
102 %v = load <4 x i64>, ptr %src
103 %res = call <4 x i64> @llvm.ctlz.v4i64(<4 x i64> %v, i1 false)
104 store <4 x i64> %res, ptr %dst
108 declare <32 x i8> @llvm.ctpop.v32i8(<32 x i8>)
109 declare <16 x i16> @llvm.ctpop.v16i16(<16 x i16>)
110 declare <8 x i32> @llvm.ctpop.v8i32(<8 x i32>)
111 declare <4 x i64> @llvm.ctpop.v4i64(<4 x i64>)
112 declare <32 x i8> @llvm.ctlz.v32i8(<32 x i8>, i1)
113 declare <16 x i16> @llvm.ctlz.v16i16(<16 x i16>, i1)
114 declare <8 x i32> @llvm.ctlz.v8i32(<8 x i32>, i1)
115 declare <4 x i64> @llvm.ctlz.v4i64(<4 x i64>, i1)