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 4; Verify the cost of (vector) multiply instructions. 5 6define <2 x i8> @t1(<2 x i8> %a, <2 x i8> %b) { 7; THROUGHPUT-LABEL: 't1' 8; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i8> %a, %b 9; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i8> %1 10; 11 %1 = mul <2 x i8> %a, %b 12 ret <2 x i8> %1 13} 14 15define <4 x i8> @t2(<4 x i8> %a, <4 x i8> %b) { 16; THROUGHPUT-LABEL: 't2' 17; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i8> %a, %b 18; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i8> %1 19; 20 %1 = mul <4 x i8> %a, %b 21 ret <4 x i8> %1 22} 23 24define <8 x i8> @t3(<8 x i8> %a, <8 x i8> %b) { 25; THROUGHPUT-LABEL: 't3' 26; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i8> %a, %b 27; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %1 28; 29 %1 = mul <8 x i8> %a, %b 30 ret <8 x i8> %1 31} 32 33define <16 x i8> @t4(<16 x i8> %a, <16 x i8> %b) { 34; THROUGHPUT-LABEL: 't4' 35; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <16 x i8> %a, %b 36; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %1 37; 38 %1 = mul <16 x i8> %a, %b 39 ret <16 x i8> %1 40} 41 42define <32 x i8> @t5(<32 x i8> %a, <32 x i8> %b) { 43; THROUGHPUT-LABEL: 't5' 44; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <32 x i8> %a, %b 45; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %1 46; 47 %1 = mul <32 x i8> %a, %b 48 ret <32 x i8> %1 49} 50 51define <2 x i16> @t6(<2 x i16> %a, <2 x i16> %b) { 52; THROUGHPUT-LABEL: 't6' 53; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i16> %a, %b 54; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i16> %1 55; 56 %1 = mul <2 x i16> %a, %b 57 ret <2 x i16> %1 58} 59 60define <4 x i16> @t7(<4 x i16> %a, <4 x i16> %b) { 61; THROUGHPUT-LABEL: 't7' 62; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i16> %a, %b 63; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %1 64; 65 %1 = mul <4 x i16> %a, %b 66 ret <4 x i16> %1 67} 68 69define <8 x i16> @t8(<8 x i16> %a, <8 x i16> %b) { 70; THROUGHPUT-LABEL: 't8' 71; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i16> %a, %b 72; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %1 73; 74 %1 = mul <8 x i16> %a, %b 75 ret <8 x i16> %1 76} 77 78define <16 x i16> @t9(<16 x i16> %a, <16 x i16> %b) { 79; THROUGHPUT-LABEL: 't9' 80; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <16 x i16> %a, %b 81; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %1 82; 83 %1 = mul <16 x i16> %a, %b 84 ret <16 x i16> %1 85} 86 87define <2 x i32> @t10(<2 x i32> %a, <2 x i32> %b) { 88; THROUGHPUT-LABEL: 't10' 89; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i32> %a, %b 90; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %1 91; 92 %1 = mul <2 x i32> %a, %b 93 ret <2 x i32> %1 94} 95 96define <4 x i32> @t11(<4 x i32> %a, <4 x i32> %b) { 97; THROUGHPUT-LABEL: 't11' 98; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i32> %a, %b 99; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %1 100; 101 %1 = mul <4 x i32> %a, %b 102 ret <4 x i32> %1 103} 104 105define <8 x i32> @t12(<8 x i32> %a, <8 x i32> %b) { 106; THROUGHPUT-LABEL: 't12' 107; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <8 x i32> %a, %b 108; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %1 109; 110 %1 = mul <8 x i32> %a, %b 111 ret <8 x i32> %1 112} 113 114define <2 x i64> @t13(<2 x i64> %a, <2 x i64> %b) { 115; THROUGHPUT-LABEL: 't13' 116; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %1 = mul nsw <2 x i64> %a, %b 117; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %1 118; 119 %1 = mul nsw <2 x i64> %a, %b 120 ret <2 x i64> %1 121} 122 123define <4 x i64> @t14(<4 x i64> %a, <4 x i64> %b) { 124; THROUGHPUT-LABEL: 't14' 125; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %1 = mul nsw <4 x i64> %a, %b 126; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %1 127; 128 %1 = mul nsw <4 x i64> %a, %b 129 ret <4 x i64> %1 130} 131 132define <2 x float> @t15(<2 x float> %a, <2 x float> %b) { 133; THROUGHPUT-LABEL: 't15' 134; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = fmul <2 x float> %a, %b 135; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x float> %1 136; 137 %1 = fmul <2 x float> %a, %b 138 ret <2 x float> %1 139} 140 141define <4 x float> @t16(<4 x float> %a, <4 x float> %b) { 142; THROUGHPUT-LABEL: 't16' 143; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = fmul <4 x float> %a, %b 144; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %1 145; 146 %1 = fmul <4 x float> %a, %b 147 ret <4 x float> %1 148} 149 150define <8 x float> @t17(<8 x float> %a, <8 x float> %b) { 151; THROUGHPUT-LABEL: 't17' 152; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %1 = fmul <8 x float> %a, %b 153; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %1 154; 155 %1 = fmul <8 x float> %a, %b 156 ret <8 x float> %1 157} 158 159define <2 x half> @t18(<2 x half> %a, <2 x half> %b) { 160; THROUGHPUT-LABEL: 't18' 161; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = fmul <2 x half> %a, %b 162; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x half> %1 163; 164 %1 = fmul <2 x half> %a, %b 165 ret <2 x half> %1 166} 167 168define <4 x half> @t19(<4 x half> %a, <4 x half> %b) { 169; THROUGHPUT-LABEL: 't19' 170; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = fmul <4 x half> %a, %b 171; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x half> %1 172; 173 %1 = fmul <4 x half> %a, %b 174 ret <4 x half> %1 175} 176 177define <8 x half> @t20(<8 x half> %a, <8 x half> %b) { 178; THROUGHPUT-LABEL: 't20' 179; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 58 for instruction: %1 = fmul <8 x half> %a, %b 180; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x half> %1 181; 182 %1 = fmul <8 x half> %a, %b 183 ret <8 x half> %1 184} 185 186define <16 x half> @t21(<16 x half> %a, <16 x half> %b) { 187; THROUGHPUT-LABEL: 't21' 188; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 116 for instruction: %1 = fmul <16 x half> %a, %b 189; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x half> %1 190; 191 %1 = fmul <16 x half> %a, %b 192 ret <16 x half> %1 193} 194 195define <2 x double> @t22(<2 x double> %a, <2 x double> %b) { 196; THROUGHPUT-LABEL: 't22' 197; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = fmul <2 x double> %a, %b 198; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %1 199; 200 %1 = fmul <2 x double> %a, %b 201 ret <2 x double> %1 202} 203 204define <4 x double> @t23(<4 x double> %a, <4 x double> %b) { 205; THROUGHPUT-LABEL: 't23' 206; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %1 = fmul <4 x double> %a, %b 207; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %1 208; 209 %1 = fmul <4 x double> %a, %b 210 ret <4 x double> %1 211} 212