1 ; RUN: llc < %s -march=avr | FileCheck %s
3 define i8 @count_population(i8) unnamed_addr {
5 %1 = tail call i8 @llvm.ctpop.i8(i8 %0)
9 declare i8 @llvm.ctpop.i8(i8)
11 ; CHECK-LABEL: count_population:
12 ; CHECK: mov [[SCRATCH:r[0-9]+]], [[RESULT:r[0-9]+]]
13 ; CHECK: lsr {{.*}}[[SCRATCH]]
14 ; CHECK: andi {{.*}}[[SCRATCH]], 85
15 ; CHECK: sub {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
16 ; CHECK: mov {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
17 ; CHECK: andi {{.*}}[[SCRATCH]], 51
18 ; CHECK: lsr {{.*}}[[RESULT]]
19 ; CHECK: lsr {{.*}}[[RESULT]]
20 ; CHECK: andi {{.*}}[[RESULT]], 51
21 ; CHECK: add {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
22 ; CHECK: mov {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
23 ; CHECK: lsr {{.*}}[[SCRATCH]]
24 ; CHECK: lsr {{.*}}[[SCRATCH]]
25 ; CHECK: lsr {{.*}}[[SCRATCH]]
26 ; CHECK: lsr {{.*}}[[SCRATCH]]
27 ; CHECK: add {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
28 ; CHECK: andi {{.*}}[[SCRATCH]], 15
29 ; CHECK: mov {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]