1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -mtriple=aarch64 -cost-model -analyze | FileCheck %s
4 ; Verify the cost of scalar ctlz instructions.
6 define i64 @test_ctlz_i64(i64 %a) {
8 ; CHECK-LABEL: 'test_ctlz_i64'
9 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call i64 @llvm.ctlz.i64(i64 %a, i1 false)
10 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %ctlz
12 %ctlz = call i64 @llvm.ctlz.i64(i64 %a)
16 define i32 @test_ctlz_i32(i32 %a) {
18 ; CHECK-LABEL: 'test_ctlz_i32'
19 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call i32 @llvm.ctlz.i32(i32 %a, i1 false)
20 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %ctlz
22 %ctlz = call i32 @llvm.ctlz.i32(i32 %a)
26 define i16 @test_ctlz_i16(i16 %a) {
28 ; CHECK-LABEL: 'test_ctlz_i16'
29 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call i16 @llvm.ctlz.i16(i16 %a, i1 false)
30 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %ctlz
32 %ctlz = call i16 @llvm.ctlz.i16(i16 %a)
36 define i8 @test_ctlz_i8(i8 %a) {
38 ; CHECK-LABEL: 'test_ctlz_i8'
39 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call i8 @llvm.ctlz.i8(i8 %a, i1 false)
40 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %ctlz
42 %ctlz = call i8 @llvm.ctlz.i8(i8 %a)
46 declare i64 @llvm.ctlz.i64(i64)
47 declare i32 @llvm.ctlz.i32(i32)
48 declare i16 @llvm.ctlz.i16(i16)
49 declare i8 @llvm.ctlz.i8(i8)
51 ; Verify the cost of vector ctlz instructions.
53 define <2 x i64> @test_ctlz_v2i64(<2 x i64> %a) {
55 ; CHECK-LABEL: 'test_ctlz_v2i64'
56 ; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %ctlz = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a, i1 false)
57 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %ctlz
59 %ctlz = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a, i1 false)
63 define <2 x i32> @test_ctlz_v2i32(<2 x i32> %a) {
65 ; CHECK-LABEL: 'test_ctlz_v2i32'
66 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> %a, i1 false)
67 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %ctlz
69 %ctlz = call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> %a, i1 false)
73 define <4 x i32> @test_ctlz_v4i32(<4 x i32> %a) {
75 ; CHECK-LABEL: 'test_ctlz_v4i32'
76 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %a, i1 false)
77 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %ctlz
79 %ctlz = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %a, i1 false)
83 define <2 x i16> @test_ctlz_v2i16(<2 x i16> %a) {
85 ; CHECK-LABEL: 'test_ctlz_v2i16'
86 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call <2 x i16> @llvm.ctlz.v2i16(<2 x i16> %a, i1 false)
87 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i16> %ctlz
89 %ctlz = call <2 x i16> @llvm.ctlz.v2i16(<2 x i16> %a, i1 false)
93 define <4 x i16> @test_ctlz_v4i16(<4 x i16> %a) {
95 ; CHECK-LABEL: 'test_ctlz_v4i16'
96 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call <4 x i16> @llvm.ctlz.v4i16(<4 x i16> %a, i1 false)
97 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %ctlz
99 %ctlz = call <4 x i16> @llvm.ctlz.v4i16(<4 x i16> %a, i1 false)
103 define <8 x i16> @test_ctlz_v8i16(<8 x i16> %a) {
105 ; CHECK-LABEL: 'test_ctlz_v8i16'
106 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %a, i1 false)
107 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %ctlz
109 %ctlz = call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %a, i1 false)
113 define <2 x i8> @test_ctlz_v2i8(<2 x i8> %a) {
115 ; CHECK-LABEL: 'test_ctlz_v2i8'
116 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call <2 x i8> @llvm.ctlz.v2i8(<2 x i8> %a, i1 false)
117 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i8> %ctlz
119 %ctlz = call <2 x i8> @llvm.ctlz.v2i8(<2 x i8> %a, i1 false)
123 define <4 x i8> @test_ctlz_v4i8(<4 x i8> %a) {
125 ; CHECK-LABEL: 'test_ctlz_v4i8'
126 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call <4 x i8> @llvm.ctlz.v4i8(<4 x i8> %a, i1 false)
127 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i8> %ctlz
129 %ctlz = call <4 x i8> @llvm.ctlz.v4i8(<4 x i8> %a, i1 false)
133 define <8 x i8> @test_ctlz_v8i8(<8 x i8> %a) {
135 ; CHECK-LABEL: 'test_ctlz_v8i8'
136 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call <8 x i8> @llvm.ctlz.v8i8(<8 x i8> %a, i1 false)
137 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %ctlz
139 %ctlz = call <8 x i8> @llvm.ctlz.v8i8(<8 x i8> %a, i1 false)
143 define <16 x i8> @test_ctlz_v16i8(<16 x i8> %a) {
145 ; CHECK-LABEL: 'test_ctlz_v16i8'
146 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ctlz = call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %a, i1 false)
147 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %ctlz
149 %ctlz = call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %a, i1 false)
153 define <4 x i64> @test_ctlz_v4i64(<4 x i64> %a) {
154 ; CHECK-LABEL: 'test_ctlz_v4i64'
155 ; CHECK-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %ctlz = call <4 x i64> @llvm.ctlz.v4i64(<4 x i64> %a, i1 false)
156 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %ctlz
158 %ctlz = call <4 x i64> @llvm.ctlz.v4i64(<4 x i64> %a, i1 false)
162 define <8 x i32> @test_ctlz_v8i32(<8 x i32> %a) {
163 ; CHECK-LABEL: 'test_ctlz_v8i32'
164 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %ctlz = call <8 x i32> @llvm.ctlz.v8i32(<8 x i32> %a, i1 false)
165 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %ctlz
167 %ctlz = call <8 x i32> @llvm.ctlz.v8i32(<8 x i32> %a, i1 false)
171 define <16 x i16> @test_ctlz_v16i16(<16 x i16> %a) {
172 ; CHECK-LABEL: 'test_ctlz_v16i16'
173 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %ctlz = call <16 x i16> @llvm.ctlz.v16i16(<16 x i16> %a, i1 false)
174 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %ctlz
176 %ctlz = call <16 x i16> @llvm.ctlz.v16i16(<16 x i16> %a, i1 false)
180 define <32 x i8> @test_ctlz_v32i8(<32 x i8> %a) {
181 ; CHECK-LABEL: 'test_ctlz_v32i8'
182 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %ctlz = call <32 x i8> @llvm.ctlz.v32i8(<32 x i8> %a, i1 false)
183 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %ctlz
185 %ctlz = call <32 x i8> @llvm.ctlz.v32i8(<32 x i8> %a, i1 false)
189 declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>, i1)
190 declare <2 x i32> @llvm.ctlz.v2i32(<2 x i32>, i1)
191 declare <4 x i32> @llvm.ctlz.v4i32(<4 x i32>, i1)
192 declare <2 x i16> @llvm.ctlz.v2i16(<2 x i16>, i1)
193 declare <4 x i16> @llvm.ctlz.v4i16(<4 x i16>, i1)
194 declare <8 x i16> @llvm.ctlz.v8i16(<8 x i16>, i1)
195 declare <2 x i8> @llvm.ctlz.v2i8(<2 x i8>, i1)
196 declare <4 x i8> @llvm.ctlz.v4i8(<4 x i8>, i1)
197 declare <8 x i8> @llvm.ctlz.v8i8(<8 x i8>, i1)
198 declare <16 x i8> @llvm.ctlz.v16i8(<16 x i8>, i1)
200 declare <4 x i64> @llvm.ctlz.v4i64(<4 x i64>, i1)
201 declare <8 x i32> @llvm.ctlz.v8i32(<8 x i32>, i1)
202 declare <16 x i16> @llvm.ctlz.v16i16(<16 x i16>, i1)
203 declare <32 x i8> @llvm.ctlz.v32i8(<32 x i8>, i1)