75 lines · plain
1; Test population-count instruction on z152;3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z15 | FileCheck %s4 5declare i32 @llvm.ctpop.i32(i32 %a)6declare i64 @llvm.ctpop.i64(i64 %a)7 8define i32 @f1(i32 %a) {9; CHECK-LABEL: f1:10; CHECK: llgfr %r0, %r211; CHECK: popcnt %r2, %r0, 812; CHECK: br %r1413 14 %popcnt = call i32 @llvm.ctpop.i32(i32 %a)15 ret i32 %popcnt16}17 18define i32 @f2(i32 %a) {19; CHECK-LABEL: f2:20; CHECK: llghr %r0, %r221; CHECK: popcnt %r2, %r0, 822; CHECK: br %r1423 %and = and i32 %a, 6553524 %popcnt = call i32 @llvm.ctpop.i32(i32 %and)25 ret i32 %popcnt26}27 28define i32 @f3(i32 %a) {29; CHECK-LABEL: f3:30; CHECK: llgcr %r0, %r231; CHECK: popcnt %r2, %r0, 832; CHECK: br %r1433 %and = and i32 %a, 25534 %popcnt = call i32 @llvm.ctpop.i32(i32 %and)35 ret i32 %popcnt36}37 38define i64 @f4(i64 %a) {39; CHECK-LABEL: f4:40; CHECK: popcnt %r2, %r2, 841; CHECK: br %r1442 %popcnt = call i64 @llvm.ctpop.i64(i64 %a)43 ret i64 %popcnt44}45 46define i64 @f5(i64 %a) {47; CHECK-LABEL: f5:48; CHECK: llgfr %r0, %r249; CHECK: popcnt %r2, %r0, 850 %and = and i64 %a, 429496729551 %popcnt = call i64 @llvm.ctpop.i64(i64 %and)52 ret i64 %popcnt53}54 55define i64 @f6(i64 %a) {56; CHECK-LABEL: f6:57; CHECK: llghr %r0, %r258; CHECK: popcnt %r2, %r0, 859; CHECK: br %r1460 %and = and i64 %a, 6553561 %popcnt = call i64 @llvm.ctpop.i64(i64 %and)62 ret i64 %popcnt63}64 65define i64 @f7(i64 %a) {66; CHECK-LABEL: f7:67; CHECK: llgcr %r0, %r268; CHECK: popcnt %r2, %r0, 869; CHECK: br %r1470 %and = and i64 %a, 25571 %popcnt = call i64 @llvm.ctpop.i64(i64 %and)72 ret i64 %popcnt73}74 75