1 ; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
3 declare i128 @llvm.ctpop.i128(i128)
4 declare i64 @llvm.ctpop.i64(i64)
5 declare i32 @llvm.ctpop.i32(i32)
6 declare i16 @llvm.ctpop.i16(i16)
7 declare i8 @llvm.ctpop.i8(i8)
9 define i128 @func128(i128 %p) {
10 ; CHECK-LABEL: func128:
12 ; CHECK-NEXT: pcnt %s1, %s1
13 ; CHECK-NEXT: pcnt %s0, %s0
14 ; CHECK-NEXT: adds.l %s0, %s0, %s1
15 ; CHECK-NEXT: or %s1, 0, (0)1
16 ; CHECK-NEXT: b.l.t (, %s10)
17 %r = tail call i128 @llvm.ctpop.i128(i128 %p)
21 define i64 @func64(i64 %p) {
22 ; CHECK-LABEL: func64:
24 ; CHECK-NEXT: pcnt %s0, %s0
25 ; CHECK-NEXT: b.l.t (, %s10)
26 %r = tail call i64 @llvm.ctpop.i64(i64 %p)
30 define signext i32 @func32s(i32 signext %p) {
31 ; CHECK-LABEL: func32s:
33 ; CHECK-NEXT: and %s0, %s0, (32)0
34 ; CHECK-NEXT: pcnt %s0, %s0
35 ; CHECK-NEXT: b.l.t (, %s10)
36 %r = tail call i32 @llvm.ctpop.i32(i32 %p)
40 define zeroext i32 @func32z(i32 zeroext %p) {
41 ; CHECK-LABEL: func32z:
43 ; CHECK-NEXT: pcnt %s0, %s0
44 ; CHECK-NEXT: b.l.t (, %s10)
45 %r = tail call i32 @llvm.ctpop.i32(i32 %p)
49 define signext i16 @func16s(i16 signext %p) {
50 ; CHECK-LABEL: func16s:
52 ; CHECK-NEXT: and %s0, %s0, (48)0
53 ; CHECK-NEXT: pcnt %s0, %s0
54 ; CHECK-NEXT: b.l.t (, %s10)
55 %r = tail call i16 @llvm.ctpop.i16(i16 %p)
59 define zeroext i16 @func16z(i16 zeroext %p) {
60 ; CHECK-LABEL: func16z:
62 ; CHECK-NEXT: pcnt %s0, %s0
63 ; CHECK-NEXT: b.l.t (, %s10)
64 %r = tail call i16 @llvm.ctpop.i16(i16 %p)
68 define signext i8 @func8s(i8 signext %p) {
69 ; CHECK-LABEL: func8s:
71 ; CHECK-NEXT: and %s0, %s0, (56)0
72 ; CHECK-NEXT: pcnt %s0, %s0
73 ; CHECK-NEXT: b.l.t (, %s10)
74 %r = tail call i8 @llvm.ctpop.i8(i8 %p)
78 define zeroext i8 @func8z(i8 zeroext %p) {
79 ; CHECK-LABEL: func8z:
81 ; CHECK-NEXT: pcnt %s0, %s0
82 ; CHECK-NEXT: b.l.t (, %s10)
83 %r = tail call i8 @llvm.ctpop.i8(i8 %p)
87 define i128 @func128i() {
88 ; CHECK-LABEL: func128i:
90 ; CHECK-NEXT: or %s0, 16, (0)1
91 ; CHECK-NEXT: or %s1, 0, (0)1
92 ; CHECK-NEXT: b.l.t (, %s10)
93 %r = tail call i128 @llvm.ctpop.i128(i128 65535)
97 define i64 @func64i() {
98 ; CHECK-LABEL: func64i:
100 ; CHECK-NEXT: or %s0, 16, (0)1
101 ; CHECK-NEXT: b.l.t (, %s10)
102 %r = tail call i64 @llvm.ctpop.i64(i64 65535)
106 define signext i32 @func32is() {
107 ; CHECK-LABEL: func32is:
109 ; CHECK-NEXT: or %s0, 16, (0)1
110 ; CHECK-NEXT: b.l.t (, %s10)
111 %r = tail call i32 @llvm.ctpop.i32(i32 65535)
115 define zeroext i32 @func32iz() {
116 ; CHECK-LABEL: func32iz:
118 ; CHECK-NEXT: or %s0, 16, (0)1
119 ; CHECK-NEXT: b.l.t (, %s10)
120 %r = tail call i32 @llvm.ctpop.i32(i32 65535)
124 define signext i16 @func16si() {
125 ; CHECK-LABEL: func16si:
127 ; CHECK-NEXT: or %s0, 16, (0)1
128 ; CHECK-NEXT: b.l.t (, %s10)
129 %r = tail call i16 @llvm.ctpop.i16(i16 65535)
133 define zeroext i16 @func16zi() {
134 ; CHECK-LABEL: func16zi:
136 ; CHECK-NEXT: or %s0, 16, (0)1
137 ; CHECK-NEXT: b.l.t (, %s10)
138 %r = tail call i16 @llvm.ctpop.i16(i16 65535)
142 define signext i8 @func8si() {
143 ; CHECK-LABEL: func8si:
145 ; CHECK-NEXT: or %s0, 8, (0)1
146 ; CHECK-NEXT: b.l.t (, %s10)
147 %r = tail call i8 @llvm.ctpop.i8(i8 255)
151 define zeroext i8 @func8zi() {
152 ; CHECK-LABEL: func8zi:
154 ; CHECK-NEXT: or %s0, 8, (0)1
155 ; CHECK-NEXT: b.l.t (, %s10)
156 %r = tail call i8 @llvm.ctpop.i8(i8 255)