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-prefix=THROUGHPUT 3; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -cost-model -cost-kind=latency -analyze | FileCheck %s --check-prefix=LATENCY 4; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -cost-model -cost-kind=code-size -analyze | FileCheck %s --check-prefix=CODESIZE 5 6define 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 10; 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 14; 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 18; 19 %r = extractvalue {i32, i32} %agg, 0 20 ret i32 %r 21} 22 23define 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 27; 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 31; 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 35; 36 %r = extractvalue {i32, i32} %agg, 1 37 ret i32 %r 38} 39 40define 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 44; 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 48; 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 52; 53 %r = extractvalue {i32, i1} %agg, 0 54 ret i32 %r 55} 56 57define 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 61; 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 65; 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 69; 70 %r = extractvalue {i32, i1} %agg, 1 71 ret i1 %r 72} 73 74define 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 78; 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 82; 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 86; 87 %r = extractvalue {i32, float} %agg, 1 88 ret float %r 89} 90 91define [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 95; 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 99; 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 103; 104 %r = extractvalue {i32, [42 x i42]} %agg, 1 105 ret [42 x i42] %r 106} 107 108define <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 112; 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 116; 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 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 127define %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 131; 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 135; 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 139; 140 %r = extractvalue {i32, %T1} %agg, 1 141 ret %T1 %r 142} 143