Skip to content

Commit b021bdb

Browse files
committed
[AArch64] Add codesize test coverage. NFC
This adds some basic codesize test coverage for a number of instructions. Much of the results returned are not very accurate yet, especially around larger vector types but also some basic operations.
1 parent 036f5c0 commit b021bdb

19 files changed

+4565
-2262
lines changed

llvm/test/Analysis/CostModel/AArch64/aggregates.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2-
; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s --check-prefix=THROUGHPUT
3-
; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -passes="print<cost-model>" -cost-kind=latency 2>&1 -disable-output | FileCheck %s --check-prefix=LATENCY
4-
; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output | FileCheck %s --check-prefix=CODESIZE
2+
; RUN: opt < %s -mtriple=aarch64-linux-gnu -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s --check-prefix=THROUGHPUT
3+
; RUN: opt < %s -mtriple=aarch64-linux-gnu -passes="print<cost-model>" -cost-kind=latency 2>&1 -disable-output | FileCheck %s --check-prefix=LATENCY
4+
; RUN: opt < %s -mtriple=aarch64-linux-gnu -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output | FileCheck %s --check-prefix=CODESIZE
55

66
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
77

llvm/test/Analysis/CostModel/AArch64/arith-fp.ll

Lines changed: 405 additions & 196 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/AArch64/arith-widening.ll

Lines changed: 1896 additions & 940 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/AArch64/arith.ll

Lines changed: 425 additions & 208 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/AArch64/bitreverse.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2-
; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output | FileCheck %s
2+
; RUN: opt < %s -mtriple=aarch64-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output | FileCheck %s
33

44
; Verify the cost of scalar bitreverse instructions.
55

llvm/test/Analysis/CostModel/AArch64/fshl.ll

Lines changed: 177 additions & 76 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/AArch64/fshr.ll

Lines changed: 177 additions & 76 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/AArch64/gep.ll

Lines changed: 327 additions & 146 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/AArch64/min-max.ll

Lines changed: 384 additions & 186 deletions
Large diffs are not rendered by default.

llvm/test/Analysis/CostModel/AArch64/mul.ll

Lines changed: 100 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,188 @@
11
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2-
; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s --check-prefix=THROUGHPUT
2+
; RUN: opt < %s -mtriple=aarch64-linux-gnu -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s --check-prefix=RECIP
3+
; RUN: opt < %s -mtriple=aarch64-linux-gnu -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output | FileCheck %s --check-prefix=COST
34

45
; Verify the cost of (vector) multiply instructions.
56

67
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
78

89
define <2 x i8> @t1(<2 x i8> %a, <2 x i8> %b) {
9-
; THROUGHPUT-LABEL: 't1'
10-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i8> %a, %b
11-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i8> %1
10+
; RECIP-LABEL: 't1'
11+
; RECIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i8> %a, %b
12+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i8> %1
13+
;
14+
; COST-LABEL: 't1'
15+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i8> %a, %b
16+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i8> %1
1217
;
1318
%1 = mul <2 x i8> %a, %b
1419
ret <2 x i8> %1
1520
}
1621

1722
define <4 x i8> @t2(<4 x i8> %a, <4 x i8> %b) {
18-
; THROUGHPUT-LABEL: 't2'
19-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i8> %a, %b
20-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i8> %1
23+
; RECIP-LABEL: 't2'
24+
; RECIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i8> %a, %b
25+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i8> %1
26+
;
27+
; COST-LABEL: 't2'
28+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i8> %a, %b
29+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i8> %1
2130
;
2231
%1 = mul <4 x i8> %a, %b
2332
ret <4 x i8> %1
2433
}
2534

2635
define <8 x i8> @t3(<8 x i8> %a, <8 x i8> %b) {
27-
; THROUGHPUT-LABEL: 't3'
28-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i8> %a, %b
29-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %1
36+
; RECIP-LABEL: 't3'
37+
; RECIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i8> %a, %b
38+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %1
39+
;
40+
; COST-LABEL: 't3'
41+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i8> %a, %b
42+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i8> %1
3043
;
3144
%1 = mul <8 x i8> %a, %b
3245
ret <8 x i8> %1
3346
}
3447

3548
define <16 x i8> @t4(<16 x i8> %a, <16 x i8> %b) {
36-
; THROUGHPUT-LABEL: 't4'
37-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <16 x i8> %a, %b
38-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %1
49+
; RECIP-LABEL: 't4'
50+
; RECIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <16 x i8> %a, %b
51+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %1
52+
;
53+
; COST-LABEL: 't4'
54+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <16 x i8> %a, %b
55+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %1
3956
;
4057
%1 = mul <16 x i8> %a, %b
4158
ret <16 x i8> %1
4259
}
4360

4461
define <32 x i8> @t5(<32 x i8> %a, <32 x i8> %b) {
45-
; THROUGHPUT-LABEL: 't5'
46-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <32 x i8> %a, %b
47-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %1
62+
; RECIP-LABEL: 't5'
63+
; RECIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <32 x i8> %a, %b
64+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %1
65+
;
66+
; COST-LABEL: 't5'
67+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <32 x i8> %a, %b
68+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %1
4869
;
4970
%1 = mul <32 x i8> %a, %b
5071
ret <32 x i8> %1
5172
}
5273

5374
define <2 x i16> @t6(<2 x i16> %a, <2 x i16> %b) {
54-
; THROUGHPUT-LABEL: 't6'
55-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i16> %a, %b
56-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i16> %1
75+
; RECIP-LABEL: 't6'
76+
; RECIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i16> %a, %b
77+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i16> %1
78+
;
79+
; COST-LABEL: 't6'
80+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i16> %a, %b
81+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i16> %1
5782
;
5883
%1 = mul <2 x i16> %a, %b
5984
ret <2 x i16> %1
6085
}
6186

6287
define <4 x i16> @t7(<4 x i16> %a, <4 x i16> %b) {
63-
; THROUGHPUT-LABEL: 't7'
64-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i16> %a, %b
65-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %1
88+
; RECIP-LABEL: 't7'
89+
; RECIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i16> %a, %b
90+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %1
91+
;
92+
; COST-LABEL: 't7'
93+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i16> %a, %b
94+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i16> %1
6695
;
6796
%1 = mul <4 x i16> %a, %b
6897
ret <4 x i16> %1
6998
}
7099

71100
define <8 x i16> @t8(<8 x i16> %a, <8 x i16> %b) {
72-
; THROUGHPUT-LABEL: 't8'
73-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i16> %a, %b
74-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %1
101+
; RECIP-LABEL: 't8'
102+
; RECIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i16> %a, %b
103+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %1
104+
;
105+
; COST-LABEL: 't8'
106+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i16> %a, %b
107+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %1
75108
;
76109
%1 = mul <8 x i16> %a, %b
77110
ret <8 x i16> %1
78111
}
79112

80113
define <16 x i16> @t9(<16 x i16> %a, <16 x i16> %b) {
81-
; THROUGHPUT-LABEL: 't9'
82-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <16 x i16> %a, %b
83-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %1
114+
; RECIP-LABEL: 't9'
115+
; RECIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <16 x i16> %a, %b
116+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %1
117+
;
118+
; COST-LABEL: 't9'
119+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <16 x i16> %a, %b
120+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %1
84121
;
85122
%1 = mul <16 x i16> %a, %b
86123
ret <16 x i16> %1
87124
}
88125

89126
define <2 x i32> @t10(<2 x i32> %a, <2 x i32> %b) {
90-
; THROUGHPUT-LABEL: 't10'
91-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i32> %a, %b
92-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %1
127+
; RECIP-LABEL: 't10'
128+
; RECIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i32> %a, %b
129+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %1
130+
;
131+
; COST-LABEL: 't10'
132+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i32> %a, %b
133+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i32> %1
93134
;
94135
%1 = mul <2 x i32> %a, %b
95136
ret <2 x i32> %1
96137
}
97138

98139
define <4 x i32> @t11(<4 x i32> %a, <4 x i32> %b) {
99-
; THROUGHPUT-LABEL: 't11'
100-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i32> %a, %b
101-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %1
140+
; RECIP-LABEL: 't11'
141+
; RECIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i32> %a, %b
142+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %1
143+
;
144+
; COST-LABEL: 't11'
145+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i32> %a, %b
146+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %1
102147
;
103148
%1 = mul <4 x i32> %a, %b
104149
ret <4 x i32> %1
105150
}
106151

107152
define <8 x i32> @t12(<8 x i32> %a, <8 x i32> %b) {
108-
; THROUGHPUT-LABEL: 't12'
109-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <8 x i32> %a, %b
110-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %1
153+
; RECIP-LABEL: 't12'
154+
; RECIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <8 x i32> %a, %b
155+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %1
156+
;
157+
; COST-LABEL: 't12'
158+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i32> %a, %b
159+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %1
111160
;
112161
%1 = mul <8 x i32> %a, %b
113162
ret <8 x i32> %1
114163
}
115164

116165
define <2 x i64> @t13(<2 x i64> %a, <2 x i64> %b) {
117-
; THROUGHPUT-LABEL: 't13'
118-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %1 = mul nsw <2 x i64> %a, %b
119-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %1
166+
; RECIP-LABEL: 't13'
167+
; RECIP-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %1 = mul nsw <2 x i64> %a, %b
168+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %1
169+
;
170+
; COST-LABEL: 't13'
171+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul nsw <2 x i64> %a, %b
172+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %1
120173
;
121174
%1 = mul nsw <2 x i64> %a, %b
122175
ret <2 x i64> %1
123176
}
124177

125178
define <4 x i64> @t14(<4 x i64> %a, <4 x i64> %b) {
126-
; THROUGHPUT-LABEL: 't14'
127-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %1 = mul nsw <4 x i64> %a, %b
128-
; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %1
179+
; RECIP-LABEL: 't14'
180+
; RECIP-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %1 = mul nsw <4 x i64> %a, %b
181+
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %1
182+
;
183+
; COST-LABEL: 't14'
184+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul nsw <4 x i64> %a, %b
185+
; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %1
129186
;
130187
%1 = mul nsw <4 x i64> %a, %b
131188
ret <4 x i64> %1

0 commit comments

Comments
 (0)