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