136 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 32; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv32 -mattr=+f,+d,+zfh < %s | FileCheck %s --check-prefixes=RV323; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv64 -mattr=+f,+d,+zfh < %s | FileCheck %s --check-prefixes=RV644 5define void @extractelement_int(i32 %x) {6; RV32-LABEL: 'extractelement_int'7; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i8 = extractelement <2 x i8> undef, i32 %x8; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i8 = extractelement <4 x i8> undef, i32 %x9; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i8 = extractelement <8 x i8> undef, i32 %x10; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i8 = extractelement <16 x i8> undef, i32 %x11; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16i8 = extractelement <vscale x 16 x i8> undef, i32 %x12; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i16 = extractelement <2 x i16> undef, i32 %x13; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i16 = extractelement <4 x i16> undef, i32 %x14; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i16 = extractelement <8 x i16> undef, i32 %x15; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i16 = extractelement <16 x i16> undef, i32 %x16; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16i16 = extractelement <vscale x 16 x i16> undef, i32 %x17; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i32 = extractelement <2 x i32> undef, i32 %x18; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i32 = extractelement <4 x i32> undef, i32 %x19; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i32 = extractelement <8 x i32> undef, i32 %x20; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i32 = extractelement <16 x i32> undef, i32 %x21; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16i32 = extractelement <vscale x 16 x i32> undef, i32 %x22; RV32-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v2i64 = extractelement <2 x i64> undef, i32 %x23; RV32-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v4i64 = extractelement <4 x i64> undef, i32 %x24; RV32-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %v8i64 = extractelement <8 x i64> undef, i32 %x25; RV32-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v16i64 = extractelement <16 x i64> undef, i32 %x26; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16i64 = extractelement <vscale x 16 x i64> undef, i32 %x27; RV32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void28;29; RV64-LABEL: 'extractelement_int'30; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i8 = extractelement <2 x i8> undef, i32 %x31; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i8 = extractelement <4 x i8> undef, i32 %x32; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i8 = extractelement <8 x i8> undef, i32 %x33; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i8 = extractelement <16 x i8> undef, i32 %x34; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16i8 = extractelement <vscale x 16 x i8> undef, i32 %x35; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i16 = extractelement <2 x i16> undef, i32 %x36; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i16 = extractelement <4 x i16> undef, i32 %x37; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i16 = extractelement <8 x i16> undef, i32 %x38; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i16 = extractelement <16 x i16> undef, i32 %x39; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16i16 = extractelement <vscale x 16 x i16> undef, i32 %x40; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i32 = extractelement <2 x i32> undef, i32 %x41; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i32 = extractelement <4 x i32> undef, i32 %x42; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i32 = extractelement <8 x i32> undef, i32 %x43; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i32 = extractelement <16 x i32> undef, i32 %x44; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16i32 = extractelement <vscale x 16 x i32> undef, i32 %x45; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i64 = extractelement <2 x i64> undef, i32 %x46; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4i64 = extractelement <4 x i64> undef, i32 %x47; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8i64 = extractelement <8 x i64> undef, i32 %x48; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16i64 = extractelement <16 x i64> undef, i32 %x49; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16i64 = extractelement <vscale x 16 x i64> undef, i32 %x50; RV64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void51;52 %v2i8 = extractelement <2 x i8> undef, i32 %x53 %v4i8 = extractelement <4 x i8> undef, i32 %x54 %v8i8 = extractelement <8 x i8> undef, i32 %x55 %v16i8 = extractelement <16 x i8> undef, i32 %x56 %nxv16i8 = extractelement <vscale x 16 x i8> undef, i32 %x57 58 %v2i16 = extractelement <2 x i16> undef, i32 %x59 %v4i16 = extractelement <4 x i16> undef, i32 %x60 %v8i16 = extractelement <8 x i16> undef, i32 %x61 %v16i16 = extractelement <16 x i16> undef, i32 %x62 %nxv16i16 = extractelement <vscale x 16 x i16> undef, i32 %x63 64 %v2i32 = extractelement <2 x i32> undef, i32 %x65 %v4i32 = extractelement <4 x i32> undef, i32 %x66 %v8i32 = extractelement <8 x i32> undef, i32 %x67 %v16i32 = extractelement <16 x i32> undef, i32 %x68 %nxv16i32 = extractelement <vscale x 16 x i32> undef, i32 %x69 70 %v2i64 = extractelement <2 x i64> undef, i32 %x71 %v4i64 = extractelement <4 x i64> undef, i32 %x72 %v8i64 = extractelement <8 x i64> undef, i32 %x73 %v16i64 = extractelement <16 x i64> undef, i32 %x74 %nxv16i64 = extractelement <vscale x 16 x i64> undef, i32 %x75 76 ret void77}78 79define void @extractelement_fp(i32 %x) {80; RV32-LABEL: 'extractelement_fp'81; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f16 = extractelement <2 x half> undef, i32 %x82; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f16 = extractelement <4 x half> undef, i32 %x83; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f16 = extractelement <8 x half> undef, i32 %x84; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f16 = extractelement <16 x half> undef, i32 %x85; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16f16 = extractelement <vscale x 16 x half> undef, i32 %x86; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f32 = extractelement <2 x float> undef, i32 %x87; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f32 = extractelement <4 x float> undef, i32 %x88; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f32 = extractelement <8 x float> undef, i32 %x89; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f32 = extractelement <16 x float> undef, i32 %x90; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16f32 = extractelement <vscale x 16 x float> undef, i32 %x91; RV32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f64 = extractelement <2 x double> undef, i32 %x92; RV32-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f64 = extractelement <4 x double> undef, i32 %x93; RV32-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f64 = extractelement <8 x double> undef, i32 %x94; RV32-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f64 = extractelement <16 x double> undef, i32 %x95; RV32-NEXT: Cost Model: Invalid cost for instruction: %nxv16f64 = extractelement <vscale x 16 x double> undef, i32 %x96; RV32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void97;98; RV64-LABEL: 'extractelement_fp'99; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f16 = extractelement <2 x half> undef, i32 %x100; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f16 = extractelement <4 x half> undef, i32 %x101; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f16 = extractelement <8 x half> undef, i32 %x102; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f16 = extractelement <16 x half> undef, i32 %x103; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16f16 = extractelement <vscale x 16 x half> undef, i32 %x104; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f32 = extractelement <2 x float> undef, i32 %x105; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f32 = extractelement <4 x float> undef, i32 %x106; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f32 = extractelement <8 x float> undef, i32 %x107; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f32 = extractelement <16 x float> undef, i32 %x108; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16f32 = extractelement <vscale x 16 x float> undef, i32 %x109; RV64-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2f64 = extractelement <2 x double> undef, i32 %x110; RV64-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %v4f64 = extractelement <4 x double> undef, i32 %x111; RV64-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v8f64 = extractelement <8 x double> undef, i32 %x112; RV64-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %v16f64 = extractelement <16 x double> undef, i32 %x113; RV64-NEXT: Cost Model: Invalid cost for instruction: %nxv16f64 = extractelement <vscale x 16 x double> undef, i32 %x114; RV64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void115;116 %v2f16 = extractelement <2 x half> undef, i32 %x117 %v4f16 = extractelement <4 x half> undef, i32 %x118 %v8f16 = extractelement <8 x half> undef, i32 %x119 %v16f16 = extractelement <16 x half> undef, i32 %x120 %nxv16f16 = extractelement <vscale x 16 x half> undef, i32 %x121 122 %v2f32 = extractelement <2 x float> undef, i32 %x123 %v4f32 = extractelement <4 x float> undef, i32 %x124 %v8f32 = extractelement <8 x float> undef, i32 %x125 %v16f32 = extractelement <16 x float> undef, i32 %x126 %nxv16f32 = extractelement <vscale x 16 x float> undef, i32 %x127 128 %v2f64 = extractelement <2 x double> undef, i32 %x129 %v4f64 = extractelement <4 x double> undef, i32 %x130 %v8f64 = extractelement <8 x double> undef, i32 %x131 %v16f64 = extractelement <16 x double> undef, i32 %x132 %nxv16f64 = extractelement <vscale x 16 x double> undef, i32 %x133 134 ret void135}136