1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py 2; RUN: opt < %s -mtriple=aarch64--linux-gnu -passes="print<cost-model>" 2>&1 -disable-output | FileCheck %s --check-prefix=COST 3 4target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 5 6define i8 @add.i8.v8i8(<8 x i8> %v) { 7; COST-LABEL: 'add.i8.v8i8' 8; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> %v) 9; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 10; 11 %r = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> %v) 12 ret i8 %r 13} 14 15define i8 @add.i8.v16i8(<16 x i8> %v) { 16; COST-LABEL: 'add.i8.v16i8' 17; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %v) 18; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 19; 20 %r = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %v) 21 ret i8 %r 22} 23 24define i16 @add.i16.v4i16(<4 x i16> %v) { 25; COST-LABEL: 'add.i16.v4i16' 26; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %v) 27; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 28; 29 %r = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %v) 30 ret i16 %r 31} 32 33define i16 @add.i16.v8i16(<8 x i16> %v) { 34; COST-LABEL: 'add.i16.v8i16' 35; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %v) 36; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 37; 38 %r = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %v) 39 ret i16 %r 40} 41 42define i32 @add.i32.v4i32(<4 x i32> %v) { 43; COST-LABEL: 'add.i32.v4i32' 44; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %v) 45; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r 46; 47 %r = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %v) 48 ret i32 %r 49} 50 51define i8 @umin.i8.v8i8(<8 x i8> %v) { 52; COST-LABEL: 'umin.i8.v8i8' 53; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.umin.v8i8(<8 x i8> %v) 54; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 55; 56 %r = call i8 @llvm.vector.reduce.umin.v8i8(<8 x i8> %v) 57 ret i8 %r 58} 59 60define i8 @umin.i8.v16i8(<16 x i8> %v) { 61; COST-LABEL: 'umin.i8.v16i8' 62; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.umin.v16i8(<16 x i8> %v) 63; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 64; 65 %r = call i8 @llvm.vector.reduce.umin.v16i8(<16 x i8> %v) 66 ret i8 %r 67} 68 69define i16 @umin.i16.v4i16(<4 x i16> %v) { 70; COST-LABEL: 'umin.i16.v4i16' 71; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.umin.v4i16(<4 x i16> %v) 72; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 73; 74 %r = call i16 @llvm.vector.reduce.umin.v4i16(<4 x i16> %v) 75 ret i16 %r 76} 77 78define i16 @umin.i16.v8i16(<8 x i16> %v) { 79; COST-LABEL: 'umin.i16.v8i16' 80; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.umin.v8i16(<8 x i16> %v) 81; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 82; 83 %r = call i16 @llvm.vector.reduce.umin.v8i16(<8 x i16> %v) 84 ret i16 %r 85} 86 87define i32 @umin.i32.v4i32(<4 x i32> %v) { 88; COST-LABEL: 'umin.i32.v4i32' 89; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.umin.v4i32(<4 x i32> %v) 90; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r 91; 92 %r = call i32 @llvm.vector.reduce.umin.v4i32(<4 x i32> %v) 93 ret i32 %r 94} 95 96define i8 @umax.i8.v8i8(<8 x i8> %v) { 97; COST-LABEL: 'umax.i8.v8i8' 98; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.umax.v8i8(<8 x i8> %v) 99; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 100; 101 %r = call i8 @llvm.vector.reduce.umax.v8i8(<8 x i8> %v) 102 ret i8 %r 103} 104 105define i8 @umax.i8.v16i8(<16 x i8> %v) { 106; COST-LABEL: 'umax.i8.v16i8' 107; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.umax.v16i8(<16 x i8> %v) 108; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 109; 110 %r = call i8 @llvm.vector.reduce.umax.v16i8(<16 x i8> %v) 111 ret i8 %r 112} 113 114define i16 @umax.i16.v4i16(<4 x i16> %v) { 115; COST-LABEL: 'umax.i16.v4i16' 116; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.umax.v4i16(<4 x i16> %v) 117; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 118; 119 %r = call i16 @llvm.vector.reduce.umax.v4i16(<4 x i16> %v) 120 ret i16 %r 121} 122 123define i16 @umax.i16.v8i16(<8 x i16> %v) { 124; COST-LABEL: 'umax.i16.v8i16' 125; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.umax.v8i16(<8 x i16> %v) 126; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 127; 128 %r = call i16 @llvm.vector.reduce.umax.v8i16(<8 x i16> %v) 129 ret i16 %r 130} 131 132define i32 @umax.i32.v4i32(<4 x i32> %v) { 133; COST-LABEL: 'umax.i32.v4i32' 134; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.umax.v4i32(<4 x i32> %v) 135; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r 136; 137 %r = call i32 @llvm.vector.reduce.umax.v4i32(<4 x i32> %v) 138 ret i32 %r 139} 140 141define i8 @smin.i8.v8i8(<8 x i8> %v) { 142; COST-LABEL: 'smin.i8.v8i8' 143; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.smin.v8i8(<8 x i8> %v) 144; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 145; 146 %r = call i8 @llvm.vector.reduce.smin.v8i8(<8 x i8> %v) 147 ret i8 %r 148} 149 150define i8 @smin.i8.v16i8(<16 x i8> %v) { 151; COST-LABEL: 'smin.i8.v16i8' 152; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.smin.v16i8(<16 x i8> %v) 153; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 154; 155 %r = call i8 @llvm.vector.reduce.smin.v16i8(<16 x i8> %v) 156 ret i8 %r 157} 158 159define i16 @smin.i16.v4i16(<4 x i16> %v) { 160; COST-LABEL: 'smin.i16.v4i16' 161; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.smin.v4i16(<4 x i16> %v) 162; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 163; 164 %r = call i16 @llvm.vector.reduce.smin.v4i16(<4 x i16> %v) 165 ret i16 %r 166} 167 168define i16 @smin.i16.v8i16(<8 x i16> %v) { 169; COST-LABEL: 'smin.i16.v8i16' 170; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.smin.v8i16(<8 x i16> %v) 171; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 172; 173 %r = call i16 @llvm.vector.reduce.smin.v8i16(<8 x i16> %v) 174 ret i16 %r 175} 176 177define i32 @smin.i32.v4i32(<4 x i32> %v) { 178; COST-LABEL: 'smin.i32.v4i32' 179; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %v) 180; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r 181; 182 %r = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %v) 183 ret i32 %r 184} 185 186define i8 @smax.i8.v8i8(<8 x i8> %v) { 187; COST-LABEL: 'smax.i8.v8i8' 188; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.smax.v8i8(<8 x i8> %v) 189; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 190; 191 %r = call i8 @llvm.vector.reduce.smax.v8i8(<8 x i8> %v) 192 ret i8 %r 193} 194 195define i8 @smax.i8.v16i8(<16 x i8> %v) { 196; COST-LABEL: 'smax.i8.v16i8' 197; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.smax.v16i8(<16 x i8> %v) 198; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r 199; 200 %r = call i8 @llvm.vector.reduce.smax.v16i8(<16 x i8> %v) 201 ret i8 %r 202} 203 204define i16 @smax.i16.v4i16(<4 x i16> %v) { 205; COST-LABEL: 'smax.i16.v4i16' 206; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.smax.v4i16(<4 x i16> %v) 207; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 208; 209 %r = call i16 @llvm.vector.reduce.smax.v4i16(<4 x i16> %v) 210 ret i16 %r 211} 212 213define i16 @smax.i16.v8i16(<8 x i16> %v) { 214; COST-LABEL: 'smax.i16.v8i16' 215; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.smax.v8i16(<8 x i16> %v) 216; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r 217; 218 %r = call i16 @llvm.vector.reduce.smax.v8i16(<8 x i16> %v) 219 ret i16 %r 220} 221 222define i32 @smax.i32.v4i32(<4 x i32> %v) { 223; COST-LABEL: 'smax.i32.v4i32' 224; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %v) 225; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r 226; 227 %r = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %v) 228 ret i32 %r 229} 230 231define float @fmin.f32.v4f32(<4 x float> %v) { 232; COST-LABEL: 'fmin.f32.v4f32' 233; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call nnan float @llvm.vector.reduce.fmin.v4f32(<4 x float> %v) 234; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float %r 235; 236 %r = call nnan float @llvm.vector.reduce.fmin.v4f32(<4 x float> %v) 237 ret float %r 238} 239 240define float @fmax.f32.v4f32(<4 x float> %v) { 241; COST-LABEL: 'fmax.f32.v4f32' 242; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call nnan float @llvm.vector.reduce.fmax.v4f32(<4 x float> %v) 243; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float %r 244; 245 %r = call nnan float @llvm.vector.reduce.fmax.v4f32(<4 x float> %v) 246 ret float %r 247} 248 249declare i8 @llvm.vector.reduce.add.v8i8(<8 x i8>) 250declare i8 @llvm.vector.reduce.add.v16i8(<16 x i8>) 251declare i16 @llvm.vector.reduce.add.v4i16(<4 x i16>) 252declare i16 @llvm.vector.reduce.add.v8i16(<8 x i16>) 253declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) 254 255declare i8 @llvm.vector.reduce.umin.v8i8(<8 x i8>) 256declare i8 @llvm.vector.reduce.umin.v16i8(<16 x i8>) 257declare i16 @llvm.vector.reduce.umin.v4i16(<4 x i16>) 258declare i16 @llvm.vector.reduce.umin.v8i16(<8 x i16>) 259declare i32 @llvm.vector.reduce.umin.v4i32(<4 x i32>) 260 261declare i8 @llvm.vector.reduce.umax.v8i8(<8 x i8>) 262declare i8 @llvm.vector.reduce.umax.v16i8(<16 x i8>) 263declare i16 @llvm.vector.reduce.umax.v4i16(<4 x i16>) 264declare i16 @llvm.vector.reduce.umax.v8i16(<8 x i16>) 265declare i32 @llvm.vector.reduce.umax.v4i32(<4 x i32>) 266 267declare i8 @llvm.vector.reduce.smin.v8i8(<8 x i8>) 268declare i8 @llvm.vector.reduce.smin.v16i8(<16 x i8>) 269declare i16 @llvm.vector.reduce.smin.v4i16(<4 x i16>) 270declare i16 @llvm.vector.reduce.smin.v8i16(<8 x i16>) 271declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) 272 273declare i8 @llvm.vector.reduce.smax.v8i8(<8 x i8>) 274declare i8 @llvm.vector.reduce.smax.v16i8(<16 x i8>) 275declare i16 @llvm.vector.reduce.smax.v4i16(<4 x i16>) 276declare i16 @llvm.vector.reduce.smax.v8i16(<8 x i16>) 277declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) 278 279declare float @llvm.vector.reduce.fmin.v4f32(<4 x float>) 280 281declare float @llvm.vector.reduce.fmax.v4f32(<4 x float>) 282