Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py |
Fangrui Song | 7979f24 | 2020-10-31 22:29:57 -0800 | [diff] [blame] | 2 | ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -cost-kind=throughput -analyze | FileCheck %s --check-prefix=THROUGHPUT |
| 3 | ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -cost-kind=latency -analyze | FileCheck %s --check-prefix=LATENCY |
| 4 | ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -cost-kind=code-size -analyze | FileCheck %s --check-prefix=CODESIZE |
Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 5 | |
| 6 | define i32 @extract_first_i32({i32, i32} %agg) { |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 7 | ; THROUGHPUT-LABEL: 'extract_first_i32' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 8 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 0 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 9 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r |
| 10 | ; |
| 11 | ; LATENCY-LABEL: 'extract_first_i32' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 12 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 0 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 13 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r |
| 14 | ; |
| 15 | ; CODESIZE-LABEL: 'extract_first_i32' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 16 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 0 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 17 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r |
Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 18 | ; |
| 19 | %r = extractvalue {i32, i32} %agg, 0 |
| 20 | ret i32 %r |
| 21 | } |
| 22 | |
| 23 | define i32 @extract_second_i32({i32, i32} %agg) { |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 24 | ; THROUGHPUT-LABEL: 'extract_second_i32' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 25 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 26 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r |
| 27 | ; |
| 28 | ; LATENCY-LABEL: 'extract_second_i32' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 29 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 30 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r |
| 31 | ; |
| 32 | ; CODESIZE-LABEL: 'extract_second_i32' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 33 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i32 } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 34 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r |
Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 35 | ; |
| 36 | %r = extractvalue {i32, i32} %agg, 1 |
| 37 | ret i32 %r |
| 38 | } |
| 39 | |
| 40 | define i32 @extract_i32({i32, i1} %agg) { |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 41 | ; THROUGHPUT-LABEL: 'extract_i32' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 42 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 0 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 43 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r |
| 44 | ; |
| 45 | ; LATENCY-LABEL: 'extract_i32' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 46 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 0 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 47 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r |
| 48 | ; |
| 49 | ; CODESIZE-LABEL: 'extract_i32' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 50 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 0 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 51 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %r |
Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 52 | ; |
| 53 | %r = extractvalue {i32, i1} %agg, 0 |
| 54 | ret i32 %r |
| 55 | } |
| 56 | |
| 57 | define i1 @extract_i1({i32, i1} %agg) { |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 58 | ; THROUGHPUT-LABEL: 'extract_i1' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 59 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 60 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i1 %r |
| 61 | ; |
| 62 | ; LATENCY-LABEL: 'extract_i1' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 63 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 64 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i1 %r |
| 65 | ; |
| 66 | ; CODESIZE-LABEL: 'extract_i1' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 67 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, i1 } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 68 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i1 %r |
Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 69 | ; |
| 70 | %r = extractvalue {i32, i1} %agg, 1 |
| 71 | ret i1 %r |
| 72 | } |
| 73 | |
| 74 | define float @extract_float({i32, float} %agg) { |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 75 | ; THROUGHPUT-LABEL: 'extract_float' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 76 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, float } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 77 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float %r |
| 78 | ; |
| 79 | ; LATENCY-LABEL: 'extract_float' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 80 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, float } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 81 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret float %r |
| 82 | ; |
| 83 | ; CODESIZE-LABEL: 'extract_float' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 84 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, float } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 85 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret float %r |
Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 86 | ; |
| 87 | %r = extractvalue {i32, float} %agg, 1 |
| 88 | ret float %r |
| 89 | } |
| 90 | |
| 91 | define [42 x i42] @extract_array({i32, [42 x i42]} %agg) { |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 92 | ; THROUGHPUT-LABEL: 'extract_array' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 93 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, [42 x i42] } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 94 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret [42 x i42] %r |
| 95 | ; |
| 96 | ; LATENCY-LABEL: 'extract_array' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 97 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, [42 x i42] } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 98 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret [42 x i42] %r |
| 99 | ; |
| 100 | ; CODESIZE-LABEL: 'extract_array' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 101 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, [42 x i42] } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 102 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret [42 x i42] %r |
Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 103 | ; |
| 104 | %r = extractvalue {i32, [42 x i42]} %agg, 1 |
| 105 | ret [42 x i42] %r |
| 106 | } |
| 107 | |
| 108 | define <42 x i42> @extract_vector({i32, <42 x i42>} %agg) { |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 109 | ; THROUGHPUT-LABEL: 'extract_vector' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 110 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, <42 x i42> } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 111 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <42 x i42> %r |
| 112 | ; |
| 113 | ; LATENCY-LABEL: 'extract_vector' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 114 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, <42 x i42> } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 115 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <42 x i42> %r |
| 116 | ; |
| 117 | ; CODESIZE-LABEL: 'extract_vector' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 118 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, <42 x i42> } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 119 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <42 x i42> %r |
Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 120 | ; |
| 121 | %r = extractvalue {i32, <42 x i42>} %agg, 1 |
| 122 | ret <42 x i42> %r |
| 123 | } |
| 124 | |
| 125 | %T1 = type { i32, float, <4 x i1> } |
| 126 | |
| 127 | define %T1 @extract_struct({i32, %T1} %agg) { |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 128 | ; THROUGHPUT-LABEL: 'extract_struct' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 129 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, %T1 } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 130 | ; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret %T1 %r |
| 131 | ; |
| 132 | ; LATENCY-LABEL: 'extract_struct' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 133 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, %T1 } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 134 | ; LATENCY-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret %T1 %r |
| 135 | ; |
| 136 | ; CODESIZE-LABEL: 'extract_struct' |
Roman Lebedev | cc95a45 | 2019-08-29 11:50:30 +0000 | [diff] [blame] | 137 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = extractvalue { i32, %T1 } %agg, 1 |
Roman Lebedev | 31ba61b | 2019-08-12 17:45:12 +0000 | [diff] [blame] | 138 | ; CODESIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret %T1 %r |
Roman Lebedev | d68a277 | 2019-08-12 09:24:33 +0000 | [diff] [blame] | 139 | ; |
| 140 | %r = extractvalue {i32, %T1} %agg, 1 |
| 141 | ret %T1 %r |
| 142 | } |