210 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt < %s -mtriple=aarch64 -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output | FileCheck %s3 4; Verify the cost of scalar ctpop instructions.5 6target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"7 8define i64 @test_ctpop_i64(i64 %a) {9; CHECK-LABEL: 'test_ctpop_i64'10; CHECK-NEXT: Cost Model: Found costs of 4 for: %ctpop = call i64 @llvm.ctpop.i64(i64 %a)11; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i64 %ctpop12;13 %ctpop = call i64 @llvm.ctpop.i64(i64 %a)14 ret i64 %ctpop15}16 17define i32 @test_ctpop_i32(i32 %a) {18; CHECK-LABEL: 'test_ctpop_i32'19; CHECK-NEXT: Cost Model: Found costs of 5 for: %ctpop = call i32 @llvm.ctpop.i32(i32 %a)20; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 %ctpop21;22 %ctpop = call i32 @llvm.ctpop.i32(i32 %a)23 ret i32 %ctpop24}25 26define i16 @test_ctpop_i16(i16 %a) {27; CHECK-LABEL: 'test_ctpop_i16'28; CHECK-NEXT: Cost Model: Found costs of 5 for: %ctpop = call i16 @llvm.ctpop.i16(i16 %a)29; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i16 %ctpop30;31 %ctpop = call i16 @llvm.ctpop.i16(i16 %a)32 ret i16 %ctpop33}34 35define i8 @test_ctpop_i8(i8 %a) {36; CHECK-LABEL: 'test_ctpop_i8'37; CHECK-NEXT: Cost Model: Found costs of 5 for: %ctpop = call i8 @llvm.ctpop.i8(i8 %a)38; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i8 %ctpop39;40 %ctpop = call i8 @llvm.ctpop.i8(i8 %a)41 ret i8 %ctpop42}43 44declare i64 @llvm.ctpop.i64(i64)45declare i32 @llvm.ctpop.i32(i32)46declare i16 @llvm.ctpop.i16(i16)47declare i8 @llvm.ctpop.i8(i8)48 49; Verify the cost of vector ctpop instructions.50 51define <2 x i64> @test_ctpop_v2i64(<2 x i64> %a) {52; CHECK-LABEL: 'test_ctpop_v2i64'53; CHECK-NEXT: Cost Model: Found costs of 4 for: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)54; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i64> %ctpop55;56 %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)57 ret <2 x i64> %ctpop58}59 60define <2 x i32> @test_ctpop_v2i32(<2 x i32> %a) {61; CHECK-LABEL: 'test_ctpop_v2i32'62; CHECK-NEXT: Cost Model: Found costs of 3 for: %ctpop = call <2 x i32> @llvm.ctpop.v2i32(<2 x i32> %a)63; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i32> %ctpop64;65 %ctpop = call <2 x i32> @llvm.ctpop.v2i32(<2 x i32> %a)66 ret <2 x i32> %ctpop67}68 69define <4 x i32> @test_ctpop_v4i32(<4 x i32> %a) {70; CHECK-LABEL: 'test_ctpop_v4i32'71; CHECK-NEXT: Cost Model: Found costs of 3 for: %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)72; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i32> %ctpop73;74 %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)75 ret <4 x i32> %ctpop76}77 78define <2 x i16> @test_ctpop_v2i16(<2 x i16> %a) {79; CHECK-LABEL: 'test_ctpop_v2i16'80; CHECK-NEXT: Cost Model: Found costs of 4 for: %ctpop = call <2 x i16> @llvm.ctpop.v2i16(<2 x i16> %a)81; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i16> %ctpop82;83 %ctpop = call <2 x i16> @llvm.ctpop.v2i16(<2 x i16> %a)84 ret <2 x i16> %ctpop85}86 87define <4 x i16> @test_ctpop_v4i16(<4 x i16> %a) {88; CHECK-LABEL: 'test_ctpop_v4i16'89; CHECK-NEXT: Cost Model: Found costs of 2 for: %ctpop = call <4 x i16> @llvm.ctpop.v4i16(<4 x i16> %a)90; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i16> %ctpop91;92 %ctpop = call <4 x i16> @llvm.ctpop.v4i16(<4 x i16> %a)93 ret <4 x i16> %ctpop94}95 96define <8 x i16> @test_ctpop_v8i16(<8 x i16> %a) {97; CHECK-LABEL: 'test_ctpop_v8i16'98; CHECK-NEXT: Cost Model: Found costs of 2 for: %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)99; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i16> %ctpop100;101 %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)102 ret <8 x i16> %ctpop103}104 105define <2 x i8> @test_ctpop_v2i8(<2 x i8> %a) {106; CHECK-LABEL: 'test_ctpop_v2i8'107; CHECK-NEXT: Cost Model: Found costs of 4 for: %ctpop = call <2 x i8> @llvm.ctpop.v2i8(<2 x i8> %a)108; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i8> %ctpop109;110 %ctpop = call <2 x i8> @llvm.ctpop.v2i8(<2 x i8> %a)111 ret <2 x i8> %ctpop112}113 114define <4 x i8> @test_ctpop_v4i8(<4 x i8> %a) {115; CHECK-LABEL: 'test_ctpop_v4i8'116; CHECK-NEXT: Cost Model: Found costs of 3 for: %ctpop = call <4 x i8> @llvm.ctpop.v4i8(<4 x i8> %a)117; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i8> %ctpop118;119 %ctpop = call <4 x i8> @llvm.ctpop.v4i8(<4 x i8> %a)120 ret <4 x i8> %ctpop121}122 123define <8 x i8> @test_ctpop_v8i8(<8 x i8> %a) {124; CHECK-LABEL: 'test_ctpop_v8i8'125; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctpop = call <8 x i8> @llvm.ctpop.v8i8(<8 x i8> %a)126; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %ctpop127;128 %ctpop = call <8 x i8> @llvm.ctpop.v8i8(<8 x i8> %a)129 ret <8 x i8> %ctpop130}131 132define <16 x i8> @test_ctpop_v16i8(<16 x i8> %a) {133; CHECK-LABEL: 'test_ctpop_v16i8'134; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)135; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <16 x i8> %ctpop136;137 %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)138 ret <16 x i8> %ctpop139}140 141define <4 x i64> @test_ctpop_v4i64(<4 x i64> %a) {142; CHECK-LABEL: 'test_ctpop_v4i64'143; CHECK-NEXT: Cost Model: Found costs of 8 for: %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)144; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i64> %ctpop145;146 %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)147 ret <4 x i64> %ctpop148}149 150define <8 x i32> @test_ctpop_v8i32(<8 x i32> %a) {151; CHECK-LABEL: 'test_ctpop_v8i32'152; CHECK-NEXT: Cost Model: Found costs of 6 for: %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)153; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i32> %ctpop154;155 %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)156 ret <8 x i32> %ctpop157}158 159define <16 x i16> @test_ctpop_v16i16(<16 x i16> %a) {160; CHECK-LABEL: 'test_ctpop_v16i16'161; CHECK-NEXT: Cost Model: Found costs of 4 for: %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)162; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <16 x i16> %ctpop163;164 %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)165 ret <16 x i16> %ctpop166}167 168define <32 x i8> @test_ctpop_v32i8(<32 x i8> %a) {169; CHECK-LABEL: 'test_ctpop_v32i8'170; CHECK-NEXT: Cost Model: Found costs of 2 for: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)171; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <32 x i8> %ctpop172;173 %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)174 ret <32 x i8> %ctpop175}176 177define i64 @test_ctpop_noneon_i64(i64 %a) "target-features"="-fp-armv8,-neon" {178; CHECK-LABEL: 'test_ctpop_noneon_i64'179; CHECK-NEXT: Cost Model: Found costs of 12 for: %ctpop = call i64 @llvm.ctpop.i64(i64 %a)180; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i64 %ctpop181;182 %ctpop = call i64 @llvm.ctpop.i64(i64 %a)183 ret i64 %ctpop184}185 186define <2 x i64> @test_ctpop_noneon_v2i64(<2 x i64> %a) "target-features"="-fp-armv8,-neon" {187; CHECK-LABEL: 'test_ctpop_noneon_v2i64'188; CHECK-NEXT: Cost Model: Found costs of 24 for: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)189; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i64> %ctpop190;191 %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)192 ret <2 x i64> %ctpop193}194 195declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>)196declare <2 x i32> @llvm.ctpop.v2i32(<2 x i32>)197declare <4 x i32> @llvm.ctpop.v4i32(<4 x i32>)198declare <2 x i16> @llvm.ctpop.v2i16(<2 x i16>)199declare <4 x i16> @llvm.ctpop.v4i16(<4 x i16>)200declare <8 x i16> @llvm.ctpop.v8i16(<8 x i16>)201declare <2 x i8> @llvm.ctpop.v2i8(<2 x i8>)202declare <4 x i8> @llvm.ctpop.v4i8(<4 x i8>)203declare <8 x i8> @llvm.ctpop.v8i8(<8 x i8>)204declare <16 x i8> @llvm.ctpop.v16i8(<16 x i8>)205 206declare <4 x i64> @llvm.ctpop.v4i64(<4 x i64>)207declare <8 x i32> @llvm.ctpop.v8i32(<8 x i32>)208declare <16 x i16> @llvm.ctpop.v16i16(<16 x i16>)209declare <32 x i8> @llvm.ctpop.v32i8(<32 x i8>)210