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 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_cttz_i64(i64 %a) {9;10; CHECK-LABEL: 'test_cttz_i64'11; CHECK-NEXT: Cost Model: Found costs of 1 for: %cttz = call i64 @llvm.cttz.i64(i64 %a, i1 false)12; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i64 %cttz13;14 %cttz = call i64 @llvm.cttz.i64(i64 %a)15 ret i64 %cttz16}17 18define i32 @test_cttz_i32(i32 %a) {19;20; CHECK-LABEL: 'test_cttz_i32'21; CHECK-NEXT: Cost Model: Found costs of 1 for: %cttz = call i32 @llvm.cttz.i32(i32 %a, i1 false)22; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 %cttz23;24 %cttz = call i32 @llvm.cttz.i32(i32 %a)25 ret i32 %cttz26}27 28define i16 @test_cttz_i16(i16 %a) {29;30; CHECK-LABEL: 'test_cttz_i16'31; CHECK-NEXT: Cost Model: Found costs of 1 for: %cttz = call i16 @llvm.cttz.i16(i16 %a, i1 false)32; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i16 %cttz33;34 %cttz = call i16 @llvm.cttz.i16(i16 %a)35 ret i16 %cttz36}37 38define i8 @test_cttz_i8(i8 %a) {39;40; CHECK-LABEL: 'test_cttz_i8'41; CHECK-NEXT: Cost Model: Found costs of 1 for: %cttz = call i8 @llvm.cttz.i8(i8 %a, i1 false)42; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i8 %cttz43;44 %cttz = call i8 @llvm.cttz.i8(i8 %a)45 ret i8 %cttz46}47 48declare i64 @llvm.cttz.i64(i64)49declare i32 @llvm.cttz.i32(i32)50declare i16 @llvm.cttz.i16(i16)51declare i8 @llvm.cttz.i8(i8)52 53; Verify the cost of vector cttz instructions.54 55define <2 x i64> @test_cttz_v2i64(<2 x i64> %a) {56;57; CHECK-LABEL: 'test_cttz_v2i64'58; CHECK-NEXT: Cost Model: Found costs of RThru:10 CodeSize:6 Lat:10 SizeLat:10 for: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true)59; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i64> %cttz60;61 %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true)62 ret <2 x i64> %cttz63}64 65define <2 x i32> @test_cttz_v2i32(<2 x i32> %a) {66;67; CHECK-LABEL: 'test_cttz_v2i32'68; CHECK-NEXT: Cost Model: Found costs of RThru:10 CodeSize:6 Lat:10 SizeLat:10 for: %cttz = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> %a, i1 true)69; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i32> %cttz70;71 %cttz = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> %a, i1 true)72 ret <2 x i32> %cttz73}74 75define <4 x i32> @test_cttz_v4i32(<4 x i32> %a) {76;77; CHECK-LABEL: 'test_cttz_v4i32'78; CHECK-NEXT: Cost Model: Found costs of RThru:20 CodeSize:12 Lat:20 SizeLat:20 for: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 true)79; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i32> %cttz80;81 %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 true)82 ret <4 x i32> %cttz83}84 85define <2 x i16> @test_cttz_v2i16(<2 x i16> %a) {86;87; CHECK-LABEL: 'test_cttz_v2i16'88; CHECK-NEXT: Cost Model: Found costs of RThru:10 CodeSize:6 Lat:10 SizeLat:10 for: %cttz = call <2 x i16> @llvm.cttz.v2i16(<2 x i16> %a, i1 true)89; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i16> %cttz90;91 %cttz = call <2 x i16> @llvm.cttz.v2i16(<2 x i16> %a, i1 true)92 ret <2 x i16> %cttz93}94 95define <4 x i16> @test_cttz_v4i16(<4 x i16> %a) {96;97; CHECK-LABEL: 'test_cttz_v4i16'98; CHECK-NEXT: Cost Model: Found costs of RThru:20 CodeSize:12 Lat:20 SizeLat:20 for: %cttz = call <4 x i16> @llvm.cttz.v4i16(<4 x i16> %a, i1 true)99; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i16> %cttz100;101 %cttz = call <4 x i16> @llvm.cttz.v4i16(<4 x i16> %a, i1 true)102 ret <4 x i16> %cttz103}104 105define <8 x i16> @test_cttz_v8i16(<8 x i16> %a) {106;107; CHECK-LABEL: 'test_cttz_v8i16'108; CHECK-NEXT: Cost Model: Found costs of RThru:40 CodeSize:24 Lat:40 SizeLat:40 for: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 true)109; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i16> %cttz110;111 %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 true)112 ret <8 x i16> %cttz113}114 115define <2 x i8> @test_cttz_v2i8(<2 x i8> %a) {116;117; CHECK-LABEL: 'test_cttz_v2i8'118; CHECK-NEXT: Cost Model: Found costs of RThru:10 CodeSize:6 Lat:10 SizeLat:10 for: %cttz = call <2 x i8> @llvm.cttz.v2i8(<2 x i8> %a, i1 true)119; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i8> %cttz120;121 %cttz = call <2 x i8> @llvm.cttz.v2i8(<2 x i8> %a, i1 true)122 ret <2 x i8> %cttz123}124 125define <4 x i8> @test_cttz_v4i8(<4 x i8> %a) {126;127; CHECK-LABEL: 'test_cttz_v4i8'128; CHECK-NEXT: Cost Model: Found costs of RThru:20 CodeSize:12 Lat:20 SizeLat:20 for: %cttz = call <4 x i8> @llvm.cttz.v4i8(<4 x i8> %a, i1 true)129; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i8> %cttz130;131 %cttz = call <4 x i8> @llvm.cttz.v4i8(<4 x i8> %a, i1 true)132 ret <4 x i8> %cttz133}134 135define <8 x i8> @test_cttz_v8i8(<8 x i8> %a) {136;137; CHECK-LABEL: 'test_cttz_v8i8'138; CHECK-NEXT: Cost Model: Found costs of RThru:40 CodeSize:24 Lat:40 SizeLat:40 for: %cttz = call <8 x i8> @llvm.cttz.v8i8(<8 x i8> %a, i1 true)139; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %cttz140;141 %cttz = call <8 x i8> @llvm.cttz.v8i8(<8 x i8> %a, i1 true)142 ret <8 x i8> %cttz143}144 145define <16 x i8> @test_cttz_v16i8(<16 x i8> %a) {146;147; CHECK-LABEL: 'test_cttz_v16i8'148; CHECK-NEXT: Cost Model: Found costs of RThru:80 CodeSize:48 Lat:80 SizeLat:80 for: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 true)149; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <16 x i8> %cttz150;151 %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 true)152 ret <16 x i8> %cttz153}154 155define <4 x i64> @test_cttz_v4i64(<4 x i64> %a) {156;157; CHECK-LABEL: 'test_cttz_v4i64'158; CHECK-NEXT: Cost Model: Found costs of RThru:20 CodeSize:12 Lat:20 SizeLat:20 for: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 true)159; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i64> %cttz160;161 %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 true)162 ret <4 x i64> %cttz163}164 165define <8 x i32> @test_cttz_v8i32(<8 x i32> %a) {166;167; CHECK-LABEL: 'test_cttz_v8i32'168; CHECK-NEXT: Cost Model: Found costs of RThru:40 CodeSize:24 Lat:40 SizeLat:40 for: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 true)169; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i32> %cttz170;171 %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 true)172 ret <8 x i32> %cttz173}174 175define <16 x i16> @test_cttz_v16i16(<16 x i16> %a) {176;177; CHECK-LABEL: 'test_cttz_v16i16'178; CHECK-NEXT: Cost Model: Found costs of RThru:80 CodeSize:48 Lat:80 SizeLat:80 for: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 true)179; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <16 x i16> %cttz180;181 %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 true)182 ret <16 x i16> %cttz183}184 185define <32 x i8> @test_cttz_v32i8(<32 x i8> %a) {186;187; CHECK-LABEL: 'test_cttz_v32i8'188; CHECK-NEXT: Cost Model: Found costs of RThru:160 CodeSize:96 Lat:160 SizeLat:160 for: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 true)189; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <32 x i8> %cttz190;191 %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 true)192 ret <32 x i8> %cttz193}194 195declare <2 x i64> @llvm.cttz.v2i64(<2 x i64>, i1)196declare <2 x i32> @llvm.cttz.v2i32(<2 x i32>, i1)197declare <4 x i32> @llvm.cttz.v4i32(<4 x i32>, i1)198declare <2 x i16> @llvm.cttz.v2i16(<2 x i16>, i1)199declare <4 x i16> @llvm.cttz.v4i16(<4 x i16>, i1)200declare <8 x i16> @llvm.cttz.v8i16(<8 x i16>, i1)201declare <2 x i8> @llvm.cttz.v2i8(<2 x i8>, i1)202declare <4 x i8> @llvm.cttz.v4i8(<4 x i8>, i1)203declare <8 x i8> @llvm.cttz.v8i8(<8 x i8>, i1)204declare <16 x i8> @llvm.cttz.v16i8(<16 x i8>, i1)205 206declare <4 x i64> @llvm.cttz.v4i64(<4 x i64>, i1)207declare <8 x i32> @llvm.cttz.v8i32(<8 x i32>, i1)208declare <16 x i16> @llvm.cttz.v16i16(<16 x i16>, i1)209declare <32 x i8> @llvm.cttz.v32i8(<32 x i8>, i1)210