1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -cost-model -cost-kind=throughput -analyze | FileCheck %s --check-prefixes=ALL,THROUGHPUT
3 ; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -cost-model -cost-kind=latency -analyze | FileCheck %s --check-prefixes=ALL,LATENCY
4 ; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -cost-model -cost-kind=code-size -analyze | FileCheck %s --check-prefixes=ALL,CODESIZE
6 define i32 @extract_first_i32({i32, i32} %agg) {
7 ; THROUGHPUT-LABEL: 'extract_first_i32'
8 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 0
9 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
11 ; LATENCY-LABEL: 'extract_first_i32'
12 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 0
13 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
15 ; CODESIZE-LABEL: 'extract_first_i32'
16 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 0
17 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
19 %r = extractvalue {i32, i32} %agg, 0
23 define i32 @extract_second_i32({i32, i32} %agg) {
24 ; THROUGHPUT-LABEL: 'extract_second_i32'
25 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 1
26 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
28 ; LATENCY-LABEL: 'extract_second_i32'
29 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 1
30 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
32 ; CODESIZE-LABEL: 'extract_second_i32'
33 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 1
34 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
36 %r = extractvalue {i32, i32} %agg, 1
40 define i32 @extract_i32({i32, i1} %agg) {
41 ; THROUGHPUT-LABEL: 'extract_i32'
42 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 0
43 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
45 ; LATENCY-LABEL: 'extract_i32'
46 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 0
47 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
49 ; CODESIZE-LABEL: 'extract_i32'
50 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 0
51 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r
53 %r = extractvalue {i32, i1} %agg, 0
57 define i1 @extract_i1({i32, i1} %agg) {
58 ; THROUGHPUT-LABEL: 'extract_i1'
59 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 1
60 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i1 %r
62 ; LATENCY-LABEL: 'extract_i1'
63 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 1
64 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i1 %r
66 ; CODESIZE-LABEL: 'extract_i1'
67 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 1
68 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i1 %r
70 %r = extractvalue {i32, i1} %agg, 1
74 define float @extract_float({i32, float} %agg) {
75 ; THROUGHPUT-LABEL: 'extract_float'
76 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, float } %agg, 1
77 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float %r
79 ; LATENCY-LABEL: 'extract_float'
80 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, float } %agg, 1
81 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret float %r
83 ; CODESIZE-LABEL: 'extract_float'
84 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, float } %agg, 1
85 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret float %r
87 %r = extractvalue {i32, float} %agg, 1
91 define [42 x i42] @extract_array({i32, [42 x i42]} %agg) {
92 ; THROUGHPUT-LABEL: 'extract_array'
93 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, [42 x i42] } %agg, 1
94 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret [42 x i42] %r
96 ; LATENCY-LABEL: 'extract_array'
97 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, [42 x i42] } %agg, 1
98 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret [42 x i42] %r
100 ; CODESIZE-LABEL: 'extract_array'
101 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, [42 x i42] } %agg, 1
102 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret [42 x i42] %r
104 %r = extractvalue {i32, [42 x i42]} %agg, 1
108 define <42 x i42> @extract_vector({i32, <42 x i42>} %agg) {
109 ; THROUGHPUT-LABEL: 'extract_vector'
110 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, <42 x i42> } %agg, 1
111 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <42 x i42> %r
113 ; LATENCY-LABEL: 'extract_vector'
114 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, <42 x i42> } %agg, 1
115 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <42 x i42> %r
117 ; CODESIZE-LABEL: 'extract_vector'
118 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, <42 x i42> } %agg, 1
119 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <42 x i42> %r
121 %r = extractvalue {i32, <42 x i42>} %agg, 1
125 %T1 = type { i32, float, <4 x i1> }
127 define %T1 @extract_struct({i32, %T1} %agg) {
128 ; THROUGHPUT-LABEL: 'extract_struct'
129 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, %T1 } %agg, 1
130 ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret %T1 %r
132 ; LATENCY-LABEL: 'extract_struct'
133 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, %T1 } %agg, 1
134 ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret %T1 %r
136 ; CODESIZE-LABEL: 'extract_struct'
137 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, %T1 } %agg, 1
138 ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret %T1 %r
140 %r = extractvalue {i32, %T1} %agg, 1