1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -cost-model -analyze | FileCheck %s
4 ; Verify the cost of scalar bitreverse instructions.
6 declare i8 @llvm.bitreverse.i8(i8)
7 declare i16 @llvm.bitreverse.i16(i16)
8 declare i32 @llvm.bitreverse.i32(i32)
9 declare i64 @llvm.bitreverse.i64(i64)
11 define i64 @var_bitreverse_i64(i64 %a) {
12 ; CHECK-LABEL: 'var_bitreverse_i64'
13 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bitreverse = call i64 @llvm.bitreverse.i64(i64 %a)
14 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bitreverse
16 %bitreverse = call i64 @llvm.bitreverse.i64(i64 %a)
20 define i32 @var_bitreverse_i32(i32 %a) {
21 ; CHECK-LABEL: 'var_bitreverse_i32'
22 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bitreverse = call i32 @llvm.bitreverse.i32(i32 %a)
23 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bitreverse
25 %bitreverse = call i32 @llvm.bitreverse.i32(i32 %a)
29 define i16 @var_bitreverse_i16(i16 %a) {
30 ; CHECK-LABEL: 'var_bitreverse_i16'
31 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bitreverse = call i16 @llvm.bitreverse.i16(i16 %a)
32 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bitreverse
34 %bitreverse = call i16 @llvm.bitreverse.i16(i16 %a)
38 define i8 @var_bitreverse_i8(i8 %a) {
39 ; CHECK-LABEL: 'var_bitreverse_i8'
40 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bitreverse = call i8 @llvm.bitreverse.i8(i8 %a)
41 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %bitreverse
43 %bitreverse = call i8 @llvm.bitreverse.i8(i8 %a)
47 ; Verify the cost of vector bitreverse instructions.
49 declare <1 x i64> @llvm.bitreverse.v1i64(<1 x i64>)
50 declare <2 x i32> @llvm.bitreverse.v2i32(<2 x i32>)
51 declare <4 x i16> @llvm.bitreverse.v4i16(<4 x i16>)
52 declare <8 x i8> @llvm.bitreverse.v8i8(<8 x i8>)
54 declare <2 x i64> @llvm.bitreverse.v2i64(<2 x i64>)
55 declare <4 x i32> @llvm.bitreverse.v4i32(<4 x i32>)
56 declare <8 x i16> @llvm.bitreverse.v8i16(<8 x i16>)
57 declare <16 x i8> @llvm.bitreverse.v16i8(<16 x i8>)
59 declare <4 x i64> @llvm.bitreverse.v4i64(<4 x i64>)
60 declare <8 x i32> @llvm.bitreverse.v8i32(<8 x i32>)
61 declare <16 x i16> @llvm.bitreverse.v16i16(<16 x i16>)
62 declare <32 x i8> @llvm.bitreverse.v32i8(<32 x i8>)
64 define <1 x i64> @var_bitreverse_v1i64(<1 x i64> %a) {
65 ; CHECK-LABEL: 'var_bitreverse_v1i64'
66 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bitreverse = call <1 x i64> @llvm.bitreverse.v1i64(<1 x i64> %a)
67 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <1 x i64> %bitreverse
69 %bitreverse = call <1 x i64> @llvm.bitreverse.v1i64(<1 x i64> %a)
70 ret <1 x i64> %bitreverse
73 define <2 x i64> @var_bitreverse_v2i64(<2 x i64> %a) {
74 ; CHECK-LABEL: 'var_bitreverse_v2i64'
75 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bitreverse = call <2 x i64> @llvm.bitreverse.v2i64(<2 x i64> %a)
76 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %bitreverse
78 %bitreverse = call <2 x i64> @llvm.bitreverse.v2i64(<2 x i64> %a)
79 ret <2 x i64> %bitreverse
82 define <4 x i64> @var_bitreverse_v4i64(<4 x i64> %a) {
83 ; CHECK-LABEL: 'var_bitreverse_v4i64'
84 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bitreverse = call <4 x i64> @llvm.bitreverse.v4i64(<4 x i64> %a)
85 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %bitreverse
87 %bitreverse = call <4 x i64> @llvm.bitreverse.v4i64(<4 x i64> %a)
88 ret <4 x i64> %bitreverse
91 define <2 x i32> @var_bitreverse_v2i32(<2 x i32> %a) {
92 ; CHECK-LABEL: 'var_bitreverse_v2i32'
93 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bitreverse = call <2 x i32> @llvm.bitreverse.v2i32(<2 x i32> %a)
94 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %bitreverse
96 %bitreverse = call <2 x i32> @llvm.bitreverse.v2i32(<2 x i32> %a)
97 ret <2 x i32> %bitreverse
100 define <4 x i32> @var_bitreverse_v4i32(<4 x i32> %a) {
101 ; CHECK-LABEL: 'var_bitreverse_v4i32'
102 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bitreverse = call <4 x i32> @llvm.bitreverse.v4i32(<4 x i32> %a)
103 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %bitreverse
105 %bitreverse = call <4 x i32> @llvm.bitreverse.v4i32(<4 x i32> %a)
106 ret <4 x i32> %bitreverse
109 define <8 x i32> @var_bitreverse_v8i32(<8 x i32> %a) {
110 ; CHECK-LABEL: 'var_bitreverse_v8i32'
111 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bitreverse = call <8 x i32> @llvm.bitreverse.v8i32(<8 x i32> %a)
112 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %bitreverse
114 %bitreverse = call <8 x i32> @llvm.bitreverse.v8i32(<8 x i32> %a)
115 ret <8 x i32> %bitreverse
118 define <4 x i16> @var_bitreverse_v4i16(<4 x i16> %a) {
119 ; CHECK-LABEL: 'var_bitreverse_v4i16'
120 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bitreverse = call <4 x i16> @llvm.bitreverse.v4i16(<4 x i16> %a)
121 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %bitreverse
123 %bitreverse = call <4 x i16> @llvm.bitreverse.v4i16(<4 x i16> %a)
124 ret <4 x i16> %bitreverse
127 define <8 x i16> @var_bitreverse_v8i16(<8 x i16> %a) {
128 ; CHECK-LABEL: 'var_bitreverse_v8i16'
129 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bitreverse = call <8 x i16> @llvm.bitreverse.v8i16(<8 x i16> %a)
130 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %bitreverse
132 %bitreverse = call <8 x i16> @llvm.bitreverse.v8i16(<8 x i16> %a)
133 ret <8 x i16> %bitreverse
136 define <16 x i16> @var_bitreverse_v16i16(<16 x i16> %a) {
137 ; CHECK-LABEL: 'var_bitreverse_v16i16'
138 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bitreverse = call <16 x i16> @llvm.bitreverse.v16i16(<16 x i16> %a)
139 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %bitreverse
141 %bitreverse = call <16 x i16> @llvm.bitreverse.v16i16(<16 x i16> %a)
142 ret <16 x i16> %bitreverse
145 define <8 x i8> @var_bitreverse_v8i8(<8 x i8> %a) {
146 ; CHECK-LABEL: 'var_bitreverse_v8i8'
147 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bitreverse = call <8 x i8> @llvm.bitreverse.v8i8(<8 x i8> %a)
148 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %bitreverse
150 %bitreverse = call <8 x i8> @llvm.bitreverse.v8i8(<8 x i8> %a)
151 ret <8 x i8> %bitreverse
154 define <16 x i8> @var_bitreverse_v16i8(<16 x i8> %a) {
155 ; CHECK-LABEL: 'var_bitreverse_v16i8'
156 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bitreverse = call <16 x i8> @llvm.bitreverse.v16i8(<16 x i8> %a)
157 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %bitreverse
159 %bitreverse = call <16 x i8> @llvm.bitreverse.v16i8(<16 x i8> %a)
160 ret <16 x i8> %bitreverse
163 define <32 x i8> @var_bitreverse_v32i8(<32 x i8> %a) {
164 ; CHECK-LABEL: 'var_bitreverse_v32i8'
165 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bitreverse = call <32 x i8> @llvm.bitreverse.v32i8(<32 x i8> %a)
166 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %bitreverse
168 %bitreverse = call <32 x i8> @llvm.bitreverse.v32i8(<32 x i8> %a)
169 ret <32 x i8> %bitreverse