207 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 ctlz instructions.5 6target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"7 8define i64 @test_ctlz_i64(i64 %a) {9;10; CHECK-LABEL: 'test_ctlz_i64'11; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call i64 @llvm.ctlz.i64(i64 %a, i1 false)12; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i64 %ctlz13;14 %ctlz = call i64 @llvm.ctlz.i64(i64 %a)15 ret i64 %ctlz16}17 18define i32 @test_ctlz_i32(i32 %a) {19;20; CHECK-LABEL: 'test_ctlz_i32'21; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call i32 @llvm.ctlz.i32(i32 %a, i1 false)22; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 %ctlz23;24 %ctlz = call i32 @llvm.ctlz.i32(i32 %a)25 ret i32 %ctlz26}27 28define i16 @test_ctlz_i16(i16 %a) {29;30; CHECK-LABEL: 'test_ctlz_i16'31; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call i16 @llvm.ctlz.i16(i16 %a, i1 false)32; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i16 %ctlz33;34 %ctlz = call i16 @llvm.ctlz.i16(i16 %a)35 ret i16 %ctlz36}37 38define i8 @test_ctlz_i8(i8 %a) {39;40; CHECK-LABEL: 'test_ctlz_i8'41; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call i8 @llvm.ctlz.i8(i8 %a, i1 false)42; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i8 %ctlz43;44 %ctlz = call i8 @llvm.ctlz.i8(i8 %a)45 ret i8 %ctlz46}47 48declare i64 @llvm.ctlz.i64(i64)49declare i32 @llvm.ctlz.i32(i32)50declare i16 @llvm.ctlz.i16(i16)51declare i8 @llvm.ctlz.i8(i8)52 53; Verify the cost of vector ctlz instructions.54 55define <2 x i64> @test_ctlz_v2i64(<2 x i64> %a) {56;57; CHECK-LABEL: 'test_ctlz_v2i64'58; CHECK-NEXT: Cost Model: Found costs of RThru:10 CodeSize:6 Lat:10 SizeLat:10 for: %ctlz = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a, i1 false)59; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i64> %ctlz60;61 %ctlz = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a, i1 false)62 ret <2 x i64> %ctlz63}64 65define <2 x i32> @test_ctlz_v2i32(<2 x i32> %a) {66;67; CHECK-LABEL: 'test_ctlz_v2i32'68; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> %a, i1 false)69; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i32> %ctlz70;71 %ctlz = call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> %a, i1 false)72 ret <2 x i32> %ctlz73}74 75define <4 x i32> @test_ctlz_v4i32(<4 x i32> %a) {76;77; CHECK-LABEL: 'test_ctlz_v4i32'78; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %a, i1 false)79; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i32> %ctlz80;81 %ctlz = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %a, i1 false)82 ret <4 x i32> %ctlz83}84 85define <2 x i16> @test_ctlz_v2i16(<2 x i16> %a) {86;87; CHECK-LABEL: 'test_ctlz_v2i16'88; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call <2 x i16> @llvm.ctlz.v2i16(<2 x i16> %a, i1 false)89; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i16> %ctlz90;91 %ctlz = call <2 x i16> @llvm.ctlz.v2i16(<2 x i16> %a, i1 false)92 ret <2 x i16> %ctlz93}94 95define <4 x i16> @test_ctlz_v4i16(<4 x i16> %a) {96;97; CHECK-LABEL: 'test_ctlz_v4i16'98; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call <4 x i16> @llvm.ctlz.v4i16(<4 x i16> %a, i1 false)99; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i16> %ctlz100;101 %ctlz = call <4 x i16> @llvm.ctlz.v4i16(<4 x i16> %a, i1 false)102 ret <4 x i16> %ctlz103}104 105define <8 x i16> @test_ctlz_v8i16(<8 x i16> %a) {106;107; CHECK-LABEL: 'test_ctlz_v8i16'108; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %a, i1 false)109; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i16> %ctlz110;111 %ctlz = call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %a, i1 false)112 ret <8 x i16> %ctlz113}114 115define <2 x i8> @test_ctlz_v2i8(<2 x i8> %a) {116;117; CHECK-LABEL: 'test_ctlz_v2i8'118; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call <2 x i8> @llvm.ctlz.v2i8(<2 x i8> %a, i1 false)119; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i8> %ctlz120;121 %ctlz = call <2 x i8> @llvm.ctlz.v2i8(<2 x i8> %a, i1 false)122 ret <2 x i8> %ctlz123}124 125define <4 x i8> @test_ctlz_v4i8(<4 x i8> %a) {126;127; CHECK-LABEL: 'test_ctlz_v4i8'128; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call <4 x i8> @llvm.ctlz.v4i8(<4 x i8> %a, i1 false)129; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i8> %ctlz130;131 %ctlz = call <4 x i8> @llvm.ctlz.v4i8(<4 x i8> %a, i1 false)132 ret <4 x i8> %ctlz133}134 135define <8 x i8> @test_ctlz_v8i8(<8 x i8> %a) {136;137; CHECK-LABEL: 'test_ctlz_v8i8'138; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call <8 x i8> @llvm.ctlz.v8i8(<8 x i8> %a, i1 false)139; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %ctlz140;141 %ctlz = call <8 x i8> @llvm.ctlz.v8i8(<8 x i8> %a, i1 false)142 ret <8 x i8> %ctlz143}144 145define <16 x i8> @test_ctlz_v16i8(<16 x i8> %a) {146;147; CHECK-LABEL: 'test_ctlz_v16i8'148; CHECK-NEXT: Cost Model: Found costs of 1 for: %ctlz = call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %a, i1 false)149; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <16 x i8> %ctlz150;151 %ctlz = call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %a, i1 false)152 ret <16 x i8> %ctlz153}154 155define <4 x i64> @test_ctlz_v4i64(<4 x i64> %a) {156; CHECK-LABEL: 'test_ctlz_v4i64'157; CHECK-NEXT: Cost Model: Found costs of RThru:20 CodeSize:12 Lat:20 SizeLat:20 for: %ctlz = call <4 x i64> @llvm.ctlz.v4i64(<4 x i64> %a, i1 false)158; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i64> %ctlz159;160 %ctlz = call <4 x i64> @llvm.ctlz.v4i64(<4 x i64> %a, i1 false)161 ret <4 x i64> %ctlz162}163 164define <8 x i32> @test_ctlz_v8i32(<8 x i32> %a) {165; CHECK-LABEL: 'test_ctlz_v8i32'166; CHECK-NEXT: Cost Model: Found costs of 4 for: %ctlz = call <8 x i32> @llvm.ctlz.v8i32(<8 x i32> %a, i1 false)167; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i32> %ctlz168;169 %ctlz = call <8 x i32> @llvm.ctlz.v8i32(<8 x i32> %a, i1 false)170 ret <8 x i32> %ctlz171}172 173define <16 x i16> @test_ctlz_v16i16(<16 x i16> %a) {174; CHECK-LABEL: 'test_ctlz_v16i16'175; CHECK-NEXT: Cost Model: Found costs of 4 for: %ctlz = call <16 x i16> @llvm.ctlz.v16i16(<16 x i16> %a, i1 false)176; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <16 x i16> %ctlz177;178 %ctlz = call <16 x i16> @llvm.ctlz.v16i16(<16 x i16> %a, i1 false)179 ret <16 x i16> %ctlz180}181 182define <32 x i8> @test_ctlz_v32i8(<32 x i8> %a) {183; CHECK-LABEL: 'test_ctlz_v32i8'184; CHECK-NEXT: Cost Model: Found costs of 4 for: %ctlz = call <32 x i8> @llvm.ctlz.v32i8(<32 x i8> %a, i1 false)185; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <32 x i8> %ctlz186;187 %ctlz = call <32 x i8> @llvm.ctlz.v32i8(<32 x i8> %a, i1 false)188 ret <32 x i8> %ctlz189}190 191declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>, i1)192declare <2 x i32> @llvm.ctlz.v2i32(<2 x i32>, i1)193declare <4 x i32> @llvm.ctlz.v4i32(<4 x i32>, i1)194declare <2 x i16> @llvm.ctlz.v2i16(<2 x i16>, i1)195declare <4 x i16> @llvm.ctlz.v4i16(<4 x i16>, i1)196declare <8 x i16> @llvm.ctlz.v8i16(<8 x i16>, i1)197declare <2 x i8> @llvm.ctlz.v2i8(<2 x i8>, i1)198declare <4 x i8> @llvm.ctlz.v4i8(<4 x i8>, i1)199declare <8 x i8> @llvm.ctlz.v8i8(<8 x i8>, i1)200declare <16 x i8> @llvm.ctlz.v16i8(<16 x i8>, i1)201 202declare <4 x i64> @llvm.ctlz.v4i64(<4 x i64>, i1)203declare <8 x i32> @llvm.ctlz.v8i32(<8 x i32>, i1)204declare <16 x i16> @llvm.ctlz.v16i16(<16 x i16>, i1)205declare <32 x i8> @llvm.ctlz.v32i8(<32 x i8>, i1)206 207