1*3d7df0a5SSergey Kachkov; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 3 2*3d7df0a5SSergey Kachkov; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv32 -mattr=+f,+d,+zfh < %s | FileCheck %s --check-prefixes=RV32 3*3d7df0a5SSergey Kachkov; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv64 -mattr=+f,+d,+zfh < %s | FileCheck %s --check-prefixes=RV64 4*3d7df0a5SSergey Kachkov 5*3d7df0a5SSergey Kachkovdefine void @extractelement_int(i32 %x) { 6*3d7df0a5SSergey Kachkov; RV32-LABEL: 'extractelement_int' 7*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i8 = extractelement <2 x i8> undef, i32 %x 8*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i8 = extractelement <4 x i8> undef, i32 %x 9*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i8 = extractelement <8 x i8> undef, i32 %x 10*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i8 = extractelement <16 x i8> undef, i32 %x 11*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16i8 = extractelement <vscale x 16 x i8> undef, i32 %x 12*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i16 = extractelement <2 x i16> undef, i32 %x 13*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i16 = extractelement <4 x i16> undef, i32 %x 14*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i16 = extractelement <8 x i16> undef, i32 %x 15*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i16 = extractelement <16 x i16> undef, i32 %x 16*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16i16 = extractelement <vscale x 16 x i16> undef, i32 %x 17*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i32 = extractelement <2 x i32> undef, i32 %x 18*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i32 = extractelement <4 x i32> undef, i32 %x 19*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i32 = extractelement <8 x i32> undef, i32 %x 20*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i32 = extractelement <16 x i32> undef, i32 %x 21*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16i32 = extractelement <vscale x 16 x i32> undef, i32 %x 22*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v2i64 = extractelement <2 x i64> undef, i32 %x 23*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v4i64 = extractelement <4 x i64> undef, i32 %x 24*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %v8i64 = extractelement <8 x i64> undef, i32 %x 25*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v16i64 = extractelement <16 x i64> undef, i32 %x 26*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16i64 = extractelement <vscale x 16 x i64> undef, i32 %x 27*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 28*3d7df0a5SSergey Kachkov; 29*3d7df0a5SSergey Kachkov; RV64-LABEL: 'extractelement_int' 30*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i8 = extractelement <2 x i8> undef, i32 %x 31*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i8 = extractelement <4 x i8> undef, i32 %x 32*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i8 = extractelement <8 x i8> undef, i32 %x 33*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i8 = extractelement <16 x i8> undef, i32 %x 34*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16i8 = extractelement <vscale x 16 x i8> undef, i32 %x 35*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i16 = extractelement <2 x i16> undef, i32 %x 36*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i16 = extractelement <4 x i16> undef, i32 %x 37*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i16 = extractelement <8 x i16> undef, i32 %x 38*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i16 = extractelement <16 x i16> undef, i32 %x 39*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16i16 = extractelement <vscale x 16 x i16> undef, i32 %x 40*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i32 = extractelement <2 x i32> undef, i32 %x 41*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i32 = extractelement <4 x i32> undef, i32 %x 42*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i32 = extractelement <8 x i32> undef, i32 %x 43*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i32 = extractelement <16 x i32> undef, i32 %x 44*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16i32 = extractelement <vscale x 16 x i32> undef, i32 %x 45*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i64 = extractelement <2 x i64> undef, i32 %x 46*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i64 = extractelement <4 x i64> undef, i32 %x 47*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i64 = extractelement <8 x i64> undef, i32 %x 48*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i64 = extractelement <16 x i64> undef, i32 %x 49*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16i64 = extractelement <vscale x 16 x i64> undef, i32 %x 50*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 51*3d7df0a5SSergey Kachkov; 52*3d7df0a5SSergey Kachkov %v2i8 = extractelement <2 x i8> undef, i32 %x 53*3d7df0a5SSergey Kachkov %v4i8 = extractelement <4 x i8> undef, i32 %x 54*3d7df0a5SSergey Kachkov %v8i8 = extractelement <8 x i8> undef, i32 %x 55*3d7df0a5SSergey Kachkov %v16i8 = extractelement <16 x i8> undef, i32 %x 56*3d7df0a5SSergey Kachkov %nxv16i8 = extractelement <vscale x 16 x i8> undef, i32 %x 57*3d7df0a5SSergey Kachkov 58*3d7df0a5SSergey Kachkov %v2i16 = extractelement <2 x i16> undef, i32 %x 59*3d7df0a5SSergey Kachkov %v4i16 = extractelement <4 x i16> undef, i32 %x 60*3d7df0a5SSergey Kachkov %v8i16 = extractelement <8 x i16> undef, i32 %x 61*3d7df0a5SSergey Kachkov %v16i16 = extractelement <16 x i16> undef, i32 %x 62*3d7df0a5SSergey Kachkov %nxv16i16 = extractelement <vscale x 16 x i16> undef, i32 %x 63*3d7df0a5SSergey Kachkov 64*3d7df0a5SSergey Kachkov %v2i32 = extractelement <2 x i32> undef, i32 %x 65*3d7df0a5SSergey Kachkov %v4i32 = extractelement <4 x i32> undef, i32 %x 66*3d7df0a5SSergey Kachkov %v8i32 = extractelement <8 x i32> undef, i32 %x 67*3d7df0a5SSergey Kachkov %v16i32 = extractelement <16 x i32> undef, i32 %x 68*3d7df0a5SSergey Kachkov %nxv16i32 = extractelement <vscale x 16 x i32> undef, i32 %x 69*3d7df0a5SSergey Kachkov 70*3d7df0a5SSergey Kachkov %v2i64 = extractelement <2 x i64> undef, i32 %x 71*3d7df0a5SSergey Kachkov %v4i64 = extractelement <4 x i64> undef, i32 %x 72*3d7df0a5SSergey Kachkov %v8i64 = extractelement <8 x i64> undef, i32 %x 73*3d7df0a5SSergey Kachkov %v16i64 = extractelement <16 x i64> undef, i32 %x 74*3d7df0a5SSergey Kachkov %nxv16i64 = extractelement <vscale x 16 x i64> undef, i32 %x 75*3d7df0a5SSergey Kachkov 76*3d7df0a5SSergey Kachkov ret void 77*3d7df0a5SSergey Kachkov} 78*3d7df0a5SSergey Kachkov 79*3d7df0a5SSergey Kachkovdefine void @extractelement_fp(i32 %x) { 80*3d7df0a5SSergey Kachkov; RV32-LABEL: 'extractelement_fp' 81*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f16 = extractelement <2 x half> undef, i32 %x 82*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f16 = extractelement <4 x half> undef, i32 %x 83*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f16 = extractelement <8 x half> undef, i32 %x 84*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f16 = extractelement <16 x half> undef, i32 %x 85*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16f16 = extractelement <vscale x 16 x half> undef, i32 %x 86*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f32 = extractelement <2 x float> undef, i32 %x 87*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f32 = extractelement <4 x float> undef, i32 %x 88*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f32 = extractelement <8 x float> undef, i32 %x 89*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f32 = extractelement <16 x float> undef, i32 %x 90*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16f32 = extractelement <vscale x 16 x float> undef, i32 %x 91*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f64 = extractelement <2 x double> undef, i32 %x 92*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f64 = extractelement <4 x double> undef, i32 %x 93*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f64 = extractelement <8 x double> undef, i32 %x 94*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f64 = extractelement <16 x double> undef, i32 %x 95*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16f64 = extractelement <vscale x 16 x double> undef, i32 %x 96*3d7df0a5SSergey Kachkov; RV32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 97*3d7df0a5SSergey Kachkov; 98*3d7df0a5SSergey Kachkov; RV64-LABEL: 'extractelement_fp' 99*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f16 = extractelement <2 x half> undef, i32 %x 100*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f16 = extractelement <4 x half> undef, i32 %x 101*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f16 = extractelement <8 x half> undef, i32 %x 102*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f16 = extractelement <16 x half> undef, i32 %x 103*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16f16 = extractelement <vscale x 16 x half> undef, i32 %x 104*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f32 = extractelement <2 x float> undef, i32 %x 105*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f32 = extractelement <4 x float> undef, i32 %x 106*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f32 = extractelement <8 x float> undef, i32 %x 107*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f32 = extractelement <16 x float> undef, i32 %x 108*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16f32 = extractelement <vscale x 16 x float> undef, i32 %x 109*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f64 = extractelement <2 x double> undef, i32 %x 110*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f64 = extractelement <4 x double> undef, i32 %x 111*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f64 = extractelement <8 x double> undef, i32 %x 112*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f64 = extractelement <16 x double> undef, i32 %x 113*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16f64 = extractelement <vscale x 16 x double> undef, i32 %x 114*3d7df0a5SSergey Kachkov; RV64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 115*3d7df0a5SSergey Kachkov; 116*3d7df0a5SSergey Kachkov %v2f16 = extractelement <2 x half> undef, i32 %x 117*3d7df0a5SSergey Kachkov %v4f16 = extractelement <4 x half> undef, i32 %x 118*3d7df0a5SSergey Kachkov %v8f16 = extractelement <8 x half> undef, i32 %x 119*3d7df0a5SSergey Kachkov %v16f16 = extractelement <16 x half> undef, i32 %x 120*3d7df0a5SSergey Kachkov %nxv16f16 = extractelement <vscale x 16 x half> undef, i32 %x 121*3d7df0a5SSergey Kachkov 122*3d7df0a5SSergey Kachkov %v2f32 = extractelement <2 x float> undef, i32 %x 123*3d7df0a5SSergey Kachkov %v4f32 = extractelement <4 x float> undef, i32 %x 124*3d7df0a5SSergey Kachkov %v8f32 = extractelement <8 x float> undef, i32 %x 125*3d7df0a5SSergey Kachkov %v16f32 = extractelement <16 x float> undef, i32 %x 126*3d7df0a5SSergey Kachkov %nxv16f32 = extractelement <vscale x 16 x float> undef, i32 %x 127*3d7df0a5SSergey Kachkov 128*3d7df0a5SSergey Kachkov %v2f64 = extractelement <2 x double> undef, i32 %x 129*3d7df0a5SSergey Kachkov %v4f64 = extractelement <4 x double> undef, i32 %x 130*3d7df0a5SSergey Kachkov %v8f64 = extractelement <8 x double> undef, i32 %x 131*3d7df0a5SSergey Kachkov %v16f64 = extractelement <16 x double> undef, i32 %x 132*3d7df0a5SSergey Kachkov %nxv16f64 = extractelement <vscale x 16 x double> undef, i32 %x 133*3d7df0a5SSergey Kachkov 134*3d7df0a5SSergey Kachkov ret void 135*3d7df0a5SSergey Kachkov} 136