1 ; Test population-count instruction on z15
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z15 | FileCheck %s
5 declare i32 @llvm.ctpop.i32(i32 %a)
6 declare i64 @llvm.ctpop.i64(i64 %a)
8 define i32 @f1(i32 %a) {
10 ; CHECK: llgfr %r0, %r2
11 ; CHECK: popcnt %r2, %r0, 8
14 %popcnt = call i32 @llvm.ctpop.i32(i32 %a)
18 define i32 @f2(i32 %a) {
20 ; CHECK: llghr %r0, %r2
21 ; CHECK: popcnt %r2, %r0, 8
23 %and = and i32 %a, 65535
24 %popcnt = call i32 @llvm.ctpop.i32(i32 %and)
28 define i32 @f3(i32 %a) {
30 ; CHECK: llgcr %r0, %r2
31 ; CHECK: popcnt %r2, %r0, 8
33 %and = and i32 %a, 255
34 %popcnt = call i32 @llvm.ctpop.i32(i32 %and)
38 define i64 @f4(i64 %a) {
40 ; CHECK: popcnt %r2, %r2, 8
42 %popcnt = call i64 @llvm.ctpop.i64(i64 %a)
46 define i64 @f5(i64 %a) {
48 ; CHECK: llgfr %r0, %r2
49 ; CHECK: popcnt %r2, %r0, 8
50 %and = and i64 %a, 4294967295
51 %popcnt = call i64 @llvm.ctpop.i64(i64 %and)
55 define i64 @f6(i64 %a) {
57 ; CHECK: llghr %r0, %r2
58 ; CHECK: popcnt %r2, %r0, 8
60 %and = and i64 %a, 65535
61 %popcnt = call i64 @llvm.ctpop.i64(i64 %and)
65 define i64 @f7(i64 %a) {
67 ; CHECK: llgcr %r0, %r2
68 ; CHECK: popcnt %r2, %r0, 8
70 %and = and i64 %a, 255
71 %popcnt = call i64 @llvm.ctpop.i64(i64 %and)