1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py 2 3; RUN: opt -passes='print<cost-model>' 2>&1 -disable-output -S < %s | FileCheck --check-prefix=CHECK-DEFAULT %s 4; RUN: opt -aarch64-insert-extract-base-cost=0 -passes='print<cost-model>' 2>&1 -disable-output -S < %s | FileCheck --check-prefix=CHECK-LOW %s 5; RUN: opt -aarch64-insert-extract-base-cost=100000 -passes='print<cost-model>' 2>&1 -disable-output -S < %s | FileCheck --check-prefix=CHECK-HIGH %s 6 7target triple = "aarch64-unknown-linux-gnu" 8 9 10define void @ins_el0() #0 { 11; CHECK-DEFAULT-LABEL: 'ins_el0' 12; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v0 = insertelement <vscale x 16 x i8> zeroinitializer, i8 0, i64 0 13; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v1 = insertelement <vscale x 8 x i16> zeroinitializer, i16 0, i64 0 14; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2 = insertelement <vscale x 4 x i32> zeroinitializer, i32 0, i64 0 15; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3 = insertelement <vscale x 2 x i64> zeroinitializer, i64 0, i64 0 16; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4 = insertelement <vscale x 4 x float> zeroinitializer, float 0.000000e+00, i64 0 17; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5 = insertelement <vscale x 2 x double> zeroinitializer, double 0.000000e+00, i64 0 18; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 19; 20; CHECK-LOW-LABEL: 'ins_el0' 21; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v0 = insertelement <vscale x 16 x i8> zeroinitializer, i8 0, i64 0 22; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v1 = insertelement <vscale x 8 x i16> zeroinitializer, i16 0, i64 0 23; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2 = insertelement <vscale x 4 x i32> zeroinitializer, i32 0, i64 0 24; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3 = insertelement <vscale x 2 x i64> zeroinitializer, i64 0, i64 0 25; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4 = insertelement <vscale x 4 x float> zeroinitializer, float 0.000000e+00, i64 0 26; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5 = insertelement <vscale x 2 x double> zeroinitializer, double 0.000000e+00, i64 0 27; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 28; 29; CHECK-HIGH-LABEL: 'ins_el0' 30; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v0 = insertelement <vscale x 16 x i8> zeroinitializer, i8 0, i64 0 31; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v1 = insertelement <vscale x 8 x i16> zeroinitializer, i16 0, i64 0 32; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2 = insertelement <vscale x 4 x i32> zeroinitializer, i32 0, i64 0 33; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3 = insertelement <vscale x 2 x i64> zeroinitializer, i64 0, i64 0 34; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4 = insertelement <vscale x 4 x float> zeroinitializer, float 0.000000e+00, i64 0 35; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5 = insertelement <vscale x 2 x double> zeroinitializer, double 0.000000e+00, i64 0 36; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 37; 38 %v0 = insertelement <vscale x 16 x i8> zeroinitializer, i8 0, i64 0 39 %v1 = insertelement <vscale x 8 x i16> zeroinitializer, i16 0, i64 0 40 %v2 = insertelement <vscale x 4 x i32> zeroinitializer, i32 0, i64 0 41 %v3 = insertelement <vscale x 2 x i64> zeroinitializer, i64 0, i64 0 42 %v4 = insertelement <vscale x 4 x float> zeroinitializer, float 0., i64 0 43 %v5 = insertelement <vscale x 2 x double> zeroinitializer, double 0., i64 0 44 ret void 45} 46 47define void @ins_el1() #0 { 48; CHECK-DEFAULT-LABEL: 'ins_el1' 49; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v0 = insertelement <vscale x 16 x i8> zeroinitializer, i8 0, i64 1 50; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v1 = insertelement <vscale x 8 x i16> zeroinitializer, i16 0, i64 1 51; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2 = insertelement <vscale x 4 x i32> zeroinitializer, i32 0, i64 1 52; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v3 = insertelement <vscale x 2 x i64> zeroinitializer, i64 0, i64 1 53; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v4 = insertelement <vscale x 4 x float> zeroinitializer, float 0.000000e+00, i64 1 54; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v5 = insertelement <vscale x 2 x double> zeroinitializer, double 0.000000e+00, i64 1 55; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 56; 57; CHECK-LOW-LABEL: 'ins_el1' 58; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v0 = insertelement <vscale x 16 x i8> zeroinitializer, i8 0, i64 1 59; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v1 = insertelement <vscale x 8 x i16> zeroinitializer, i16 0, i64 1 60; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2 = insertelement <vscale x 4 x i32> zeroinitializer, i32 0, i64 1 61; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3 = insertelement <vscale x 2 x i64> zeroinitializer, i64 0, i64 1 62; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4 = insertelement <vscale x 4 x float> zeroinitializer, float 0.000000e+00, i64 1 63; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5 = insertelement <vscale x 2 x double> zeroinitializer, double 0.000000e+00, i64 1 64; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 65; 66; CHECK-HIGH-LABEL: 'ins_el1' 67; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v0 = insertelement <vscale x 16 x i8> zeroinitializer, i8 0, i64 1 68; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v1 = insertelement <vscale x 8 x i16> zeroinitializer, i16 0, i64 1 69; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v2 = insertelement <vscale x 4 x i32> zeroinitializer, i32 0, i64 1 70; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v3 = insertelement <vscale x 2 x i64> zeroinitializer, i64 0, i64 1 71; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v4 = insertelement <vscale x 4 x float> zeroinitializer, float 0.000000e+00, i64 1 72; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v5 = insertelement <vscale x 2 x double> zeroinitializer, double 0.000000e+00, i64 1 73; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 74; 75 %v0 = insertelement <vscale x 16 x i8> zeroinitializer, i8 0, i64 1 76 %v1 = insertelement <vscale x 8 x i16> zeroinitializer, i16 0, i64 1 77 %v2 = insertelement <vscale x 4 x i32> zeroinitializer, i32 0, i64 1 78 %v3 = insertelement <vscale x 2 x i64> zeroinitializer, i64 0, i64 1 79 %v4 = insertelement <vscale x 4 x float> zeroinitializer, float 0., i64 1 80 %v5 = insertelement <vscale x 2 x double> zeroinitializer, double 0., i64 1 81 ret void 82} 83 84 85define void @ext_el0() #0 { 86; CHECK-DEFAULT-LABEL: 'ext_el0' 87; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 0 88; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 0 89; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 0 90; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 0 91; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 0 92; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 0 93; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 94; 95; CHECK-LOW-LABEL: 'ext_el0' 96; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 0 97; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 0 98; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 0 99; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 0 100; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 0 101; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 0 102; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 103; 104; CHECK-HIGH-LABEL: 'ext_el0' 105; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 0 106; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 0 107; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 0 108; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 0 109; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 0 110; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 0 111; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 112; 113 %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 0 114 %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 0 115 %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 0 116 %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 0 117 %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 0 118 %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 0 119 ret void 120} 121 122define void @ext_el1() #0 { 123; CHECK-DEFAULT-LABEL: 'ext_el1' 124; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 1 125; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 1 126; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 1 127; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 1 128; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 1 129; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 1 130; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 131; 132; CHECK-LOW-LABEL: 'ext_el1' 133; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 1 134; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 1 135; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 1 136; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 1 137; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 1 138; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 1 139; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 140; 141; CHECK-HIGH-LABEL: 'ext_el1' 142; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 1 143; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 1 144; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 1 145; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 1 146; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 1 147; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 1 148; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 149; 150 %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 1 151 %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 1 152 %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 1 153 %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 1 154 %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 1 155 %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 1 156 ret void 157} 158 159 160; Test the behaviour in the presence of a CPU-specific override in AArch64Subtarget (via attribute set). 161define void @test_override_cpu_given() #1 { 162; CHECK-DEFAULT-LABEL: 'test_override_cpu_given' 163; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 1 164; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 1 165; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 1 166; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 1 167; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 1 168; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 1 169; CHECK-DEFAULT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 170; 171; CHECK-LOW-LABEL: 'test_override_cpu_given' 172; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 1 173; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 1 174; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 1 175; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 1 176; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 1 177; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 1 178; CHECK-LOW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 179; 180; CHECK-HIGH-LABEL: 'test_override_cpu_given' 181; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 1 182; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 1 183; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 1 184; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 1 185; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 1 186; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 100000 for instruction: %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 1 187; CHECK-HIGH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void 188; 189 %v0 = extractelement <vscale x 16 x i8> zeroinitializer, i64 1 190 %v1 = extractelement <vscale x 8 x i16> zeroinitializer, i64 1 191 %v2 = extractelement <vscale x 4 x i32> zeroinitializer, i64 1 192 %v3 = extractelement <vscale x 2 x i64> zeroinitializer, i64 1 193 %v4 = extractelement <vscale x 4 x float> zeroinitializer, i64 1 194 %v5 = extractelement <vscale x 2 x double> zeroinitializer, i64 1 195 ret void 196} 197 198 199 200 201 202attributes #0 = { "target-features"="+sve" vscale_range(1, 16) } 203attributes #1 = { "target-features"="+sve" vscale_range(1, 16) "target-cpu"="kryo" } 204