1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=-neon < %s | FileCheck %s
3 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=-neon -mattr=+cssc < %s | FileCheck %s -check-prefix=CHECK-CSSC
5 declare i128 @llvm.ctpop.i128(i128)
7 define i128 @ctpop_i128(i128 %i) {
8 ; CHECK-LABEL: ctpop_i128:
10 ; CHECK-NEXT: lsr x9, x0, #1
11 ; CHECK-NEXT: lsr x10, x1, #1
12 ; CHECK-NEXT: mov x8, #72340172838076673 // =0x101010101010101
13 ; CHECK-NEXT: and x9, x9, #0x5555555555555555
14 ; CHECK-NEXT: and x10, x10, #0x5555555555555555
15 ; CHECK-NEXT: sub x9, x0, x9
16 ; CHECK-NEXT: sub x10, x1, x10
17 ; CHECK-NEXT: mov x1, xzr
18 ; CHECK-NEXT: lsr x11, x9, #2
19 ; CHECK-NEXT: lsr x12, x10, #2
20 ; CHECK-NEXT: and x9, x9, #0x3333333333333333
21 ; CHECK-NEXT: and x10, x10, #0x3333333333333333
22 ; CHECK-NEXT: and x11, x11, #0x3333333333333333
23 ; CHECK-NEXT: add x9, x9, x11
24 ; CHECK-NEXT: and x11, x12, #0x3333333333333333
25 ; CHECK-NEXT: add x9, x9, x9, lsr #4
26 ; CHECK-NEXT: add x10, x10, x11
27 ; CHECK-NEXT: add x10, x10, x10, lsr #4
28 ; CHECK-NEXT: and x9, x9, #0xf0f0f0f0f0f0f0f
29 ; CHECK-NEXT: mul x9, x9, x8
30 ; CHECK-NEXT: and x10, x10, #0xf0f0f0f0f0f0f0f
31 ; CHECK-NEXT: mul x8, x10, x8
32 ; CHECK-NEXT: lsr x9, x9, #56
33 ; CHECK-NEXT: add x0, x9, x8, lsr #56
36 ; CHECK-CSSC-LABEL: ctpop_i128:
37 ; CHECK-CSSC: // %bb.0:
38 ; CHECK-CSSC-NEXT: cnt x8, x1
39 ; CHECK-CSSC-NEXT: cnt x9, x0
40 ; CHECK-CSSC-NEXT: mov x1, xzr
41 ; CHECK-CSSC-NEXT: add x0, x9, x8
42 ; CHECK-CSSC-NEXT: ret
43 %c = call i128 @llvm.ctpop.i128(i128 %i)