1*9880d681SAndroid Build Coastguard Worker; Test vector population-count instruction 2*9880d681SAndroid Build Coastguard Worker; 3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workerdeclare <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a) 6*9880d681SAndroid Build Coastguard Workerdeclare <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a) 7*9880d681SAndroid Build Coastguard Workerdeclare <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a) 8*9880d681SAndroid Build Coastguard Workerdeclare <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a) 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Workerdefine <16 x i8> @f1(<16 x i8> %a) { 11*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1: 12*9880d681SAndroid Build Coastguard Worker; CHECK: vpopct %v24, %v24, 0 13*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker %popcnt = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a) 16*9880d681SAndroid Build Coastguard Worker ret <16 x i8> %popcnt 17*9880d681SAndroid Build Coastguard Worker} 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @f2(<8 x i16> %a) { 20*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2: 21*9880d681SAndroid Build Coastguard Worker; CHECK: vpopct [[T1:%v[0-9]+]], %v24, 0 22*9880d681SAndroid Build Coastguard Worker; CHECK: veslh [[T2:%v[0-9]+]], [[T1]], 8 23*9880d681SAndroid Build Coastguard Worker; CHECK: vah [[T3:%v[0-9]+]], [[T1]], [[T2]] 24*9880d681SAndroid Build Coastguard Worker; CHECK: vesrlh %v24, [[T3]], 8 25*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker %popcnt = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a) 28*9880d681SAndroid Build Coastguard Worker ret <8 x i16> %popcnt 29*9880d681SAndroid Build Coastguard Worker} 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @f3(<4 x i32> %a) { 32*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3: 33*9880d681SAndroid Build Coastguard Worker; CHECK: vpopct [[T1:%v[0-9]+]], %v24, 0 34*9880d681SAndroid Build Coastguard Worker; CHECK: vgbm [[T2:%v[0-9]+]], 0 35*9880d681SAndroid Build Coastguard Worker; CHECK: vsumb %v24, [[T1]], [[T2]] 36*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker %popcnt = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a) 39*9880d681SAndroid Build Coastguard Worker ret <4 x i32> %popcnt 40*9880d681SAndroid Build Coastguard Worker} 41*9880d681SAndroid Build Coastguard Worker 42*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @f4(<2 x i64> %a) { 43*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f4: 44*9880d681SAndroid Build Coastguard Worker; CHECK: vpopct [[T1:%v[0-9]+]], %v24, 0 45*9880d681SAndroid Build Coastguard Worker; CHECK: vgbm [[T2:%v[0-9]+]], 0 46*9880d681SAndroid Build Coastguard Worker; CHECK: vsumb [[T3:%v[0-9]+]], [[T1]], [[T2]] 47*9880d681SAndroid Build Coastguard Worker; CHECK: vsumgf %v24, [[T3]], [[T2]] 48*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 49*9880d681SAndroid Build Coastguard Worker 50*9880d681SAndroid Build Coastguard Worker %popcnt = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a) 51*9880d681SAndroid Build Coastguard Worker ret <2 x i64> %popcnt 52*9880d681SAndroid Build Coastguard Worker} 53*9880d681SAndroid Build Coastguard Worker 54