1 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 ; CHECK-LABEL: popcount_16
6 define i16 @popcount_16(i16 %p) #0 {
7 %t = call i16 @llvm.ctpop.i16(i16 %p) #0
11 ; CHECK-LABEL: popcount_32
13 define i32 @popcount_32(i32 %p) #0 {
14 %t = call i32 @llvm.ctpop.i32(i32 %p) #0
18 ; CHECK-LABEL: popcount_64
20 define i64 @popcount_64(i64 %p) #0 {
21 %t = call i64 @llvm.ctpop.i64(i64 %p) #0
25 ; CHECK-LABEL: ctlz_16
26 ; CHECK: [[REG0:r[0-9]+]] = zxth
27 ; CHECK: [[REG1:r[0-9]+]] = cl0([[REG0]])
28 ; CHECK: add([[REG1]],#-16)
29 define i16 @ctlz_16(i16 %p) #0 {
30 %t = call i16 @llvm.ctlz.i16(i16 %p, i1 true) #0
34 ; CHECK-LABEL: ctlz_32
36 define i32 @ctlz_32(i32 %p) #0 {
37 %t = call i32 @llvm.ctlz.i32(i32 %p, i1 true) #0
41 ; CHECK-LABEL: ctlz_64
43 define i64 @ctlz_64(i64 %p) #0 {
44 %t = call i64 @llvm.ctlz.i64(i64 %p, i1 true) #0
48 ; CHECK-LABEL: cttz_16
50 define i16 @cttz_16(i16 %p) #0 {
51 %t = call i16 @llvm.cttz.i16(i16 %p, i1 true) #0
55 ; CHECK-LABEL: cttz_32
57 define i32 @cttz_32(i32 %p) #0 {
58 %t = call i32 @llvm.cttz.i32(i32 %p, i1 true) #0
62 ; CHECK-LABEL: cttz_64
64 define i64 @cttz_64(i64 %p) #0 {
65 %t = call i64 @llvm.cttz.i64(i64 %p, i1 true) #0
69 ; CHECK-LABEL: brev_16
70 ; CHECK: [[REG:r[0-9]+]] = brev
71 ; CHECK: lsr([[REG]],#16)
72 define i16 @brev_16(i16 %p) #0 {
73 %t = call i16 @llvm.bitreverse.i16(i16 %p) #0
77 ; CHECK-LABEL: brev_32
79 define i32 @brev_32(i32 %p) #0 {
80 %t = call i32 @llvm.bitreverse.i32(i32 %p) #0
84 ; CHECK-LABEL: brev_64
86 define i64 @brev_64(i64 %p) #0 {
87 %t = call i64 @llvm.bitreverse.i64(i64 %p) #0
91 ; CHECK-LABEL: bswap_16
92 ; CHECK: [[REG:r[0-9]+]] = swiz
93 ; CHECK: lsr([[REG]],#16)
94 define i16 @bswap_16(i16 %p) #0 {
95 %t = call i16 @llvm.bswap.i16(i16 %p) #0
99 ; CHECK-LABEL: bswap_32
101 define i32 @bswap_32(i32 %p) #0 {
102 %t = call i32 @llvm.bswap.i32(i32 %p) #0
106 ; CHECK-LABEL: bswap_64
110 define i64 @bswap_64(i64 %p) #0 {
111 %t = call i64 @llvm.bswap.i64(i64 %p) #0
115 declare i16 @llvm.ctpop.i16(i16) #0
116 declare i32 @llvm.ctpop.i32(i32) #0
117 declare i64 @llvm.ctpop.i64(i64) #0
119 declare i16 @llvm.ctlz.i16(i16, i1) #0
120 declare i32 @llvm.ctlz.i32(i32, i1) #0
121 declare i64 @llvm.ctlz.i64(i64, i1) #0
123 declare i16 @llvm.cttz.i16(i16, i1) #0
124 declare i32 @llvm.cttz.i32(i32, i1) #0
125 declare i64 @llvm.cttz.i64(i64, i1) #0
127 declare i16 @llvm.bitreverse.i16(i16) #0
128 declare i32 @llvm.bitreverse.i32(i32) #0
129 declare i64 @llvm.bitreverse.i64(i64) #0
131 declare i16 @llvm.bswap.i16(i16) #0
132 declare i32 @llvm.bswap.i32(i32) #0
133 declare i64 @llvm.bswap.i64(i64) #0
135 attributes #0 = { nounwind readnone }