399 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt -mtriple=riscv32 -mattr=+v -passes="print<cost-model>" 2>&1 \3; RUN: -disable-output < %s | FileCheck %s -check-prefix=RVI4; RUN: opt -mtriple=riscv64 -mattr=+v -passes="print<cost-model>" 2>&1 \5; RUN: -disable-output < %s | FileCheck %s -check-prefix=RVI6 7define void @testi8(ptr %a, i32 %i) {8; RVI-LABEL: 'testi8'9; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds i8, ptr %a, i32 110; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a1, align 111; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds i8, ptr %a, i32 -112; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a2, align 113; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds i8, ptr %a, i32 204714; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a3, align 115; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds i8, ptr %a, i32 204816; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a4, align 117; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds i8, ptr %a, i32 -204818; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a5, align 119; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds i8, ptr %a, i32 -204920; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a6, align 121; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds i8, ptr %a, i32 %i22; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %ai, align 123; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void24;25 %a1 = getelementptr inbounds i8, ptr %a, i32 126 store volatile i8 undef, ptr %a127 %a2 = getelementptr inbounds i8, ptr %a, i32 -128 store volatile i8 undef, ptr %a229 %a3 = getelementptr inbounds i8, ptr %a, i32 204730 store volatile i8 undef, ptr %a331 %a4 = getelementptr inbounds i8, ptr %a, i32 204832 store volatile i8 undef, ptr %a433 %a5 = getelementptr inbounds i8, ptr %a, i32 -204834 store volatile i8 undef, ptr %a535 %a6 = getelementptr inbounds i8, ptr %a, i32 -204936 store volatile i8 undef, ptr %a637 %ai = getelementptr inbounds i8, ptr %a, i32 %i38 store volatile i8 undef, ptr %ai39 ret void40}41 42define void @testi16(ptr %a, i32 %i) {43; RVI-LABEL: 'testi16'44; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds i16, ptr %a, i32 145; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a1, align 246; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds i16, ptr %a, i32 -147; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a2, align 248; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds i16, ptr %a, i32 102349; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a3, align 250; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds i16, ptr %a, i32 102451; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a4, align 252; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds i16, ptr %a, i32 -102453; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a5, align 254; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds i16, ptr %a, i32 -102555; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a6, align 256; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds i16, ptr %a, i32 %i57; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %ai, align 258; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void59;60 %a1 = getelementptr inbounds i16, ptr %a, i32 161 store volatile i16 undef, ptr %a162 %a2 = getelementptr inbounds i16, ptr %a, i32 -163 store volatile i16 undef, ptr %a264 %a3 = getelementptr inbounds i16, ptr %a, i32 102365 store volatile i16 undef, ptr %a366 %a4 = getelementptr inbounds i16, ptr %a, i32 102467 store volatile i16 undef, ptr %a468 %a5 = getelementptr inbounds i16, ptr %a, i32 -102469 store volatile i16 undef, ptr %a570 %a6 = getelementptr inbounds i16, ptr %a, i32 -102571 store volatile i16 undef, ptr %a672 %ai = getelementptr inbounds i16, ptr %a, i32 %i73 store volatile i16 undef, ptr %ai74 ret void75}76 77define void @testi32(ptr %a, i32 %i) {78; RVI-LABEL: 'testi32'79; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds i32, ptr %a, i32 180; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a1, align 481; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds i32, ptr %a, i32 -182; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a2, align 483; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds i32, ptr %a, i32 51184; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a3, align 485; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds i32, ptr %a, i32 51286; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a4, align 487; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds i32, ptr %a, i32 -51288; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a5, align 489; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds i32, ptr %a, i32 -51390; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a6, align 491; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds i32, ptr %a, i32 %i92; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %ai, align 493; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void94;95 %a1 = getelementptr inbounds i32, ptr %a, i32 196 store volatile i32 undef, ptr %a197 %a2 = getelementptr inbounds i32, ptr %a, i32 -198 store volatile i32 undef, ptr %a299 %a3 = getelementptr inbounds i32, ptr %a, i32 511100 store volatile i32 undef, ptr %a3101 %a4 = getelementptr inbounds i32, ptr %a, i32 512102 store volatile i32 undef, ptr %a4103 %a5 = getelementptr inbounds i32, ptr %a, i32 -512104 store volatile i32 undef, ptr %a5105 %a6 = getelementptr inbounds i32, ptr %a, i32 -513106 store volatile i32 undef, ptr %a6107 %ai = getelementptr inbounds i32, ptr %a, i32 %i108 store volatile i32 undef, ptr %ai109 ret void110}111 112define void @testi64(ptr %a, i32 %i) {113 %a1 = getelementptr inbounds i64, ptr %a, i32 1114 store volatile i64 undef, ptr %a1115 %a2 = getelementptr inbounds i64, ptr %a, i32 -1116 store volatile i64 undef, ptr %a2117 %a3 = getelementptr inbounds i64, ptr %a, i32 255118 store volatile i64 undef, ptr %a3119 %a4 = getelementptr inbounds i64, ptr %a, i32 256120 store volatile i64 undef, ptr %a4121 %a5 = getelementptr inbounds i64, ptr %a, i32 -256122 store volatile i64 undef, ptr %a5123 %a6 = getelementptr inbounds i64, ptr %a, i32 -257124 store volatile i64 undef, ptr %a6125 %ai = getelementptr inbounds i64, ptr %a, i32 %i126 store volatile i64 undef, ptr %ai127 ret void128}129 130define void @testfloat(ptr %a, i32 %i) {131; RVI-LABEL: 'testfloat'132; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds float, ptr %a, i32 1133; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a1, align 4134; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds float, ptr %a, i32 -1135; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a2, align 4136; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds float, ptr %a, i32 511137; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a3, align 4138; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds float, ptr %a, i32 512139; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a4, align 4140; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds float, ptr %a, i32 -512141; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a5, align 4142; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds float, ptr %a, i32 -513143; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a6, align 4144; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds float, ptr %a, i32 %i145; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %ai, align 4146; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void147;148 %a1 = getelementptr inbounds float, ptr %a, i32 1149 store volatile float undef, ptr %a1150 %a2 = getelementptr inbounds float, ptr %a, i32 -1151 store volatile float undef, ptr %a2152 %a3 = getelementptr inbounds float, ptr %a, i32 511153 store volatile float undef, ptr %a3154 %a4 = getelementptr inbounds float, ptr %a, i32 512155 store volatile float undef, ptr %a4156 %a5 = getelementptr inbounds float, ptr %a, i32 -512157 store volatile float undef, ptr %a5158 %a6 = getelementptr inbounds float, ptr %a, i32 -513159 store volatile float undef, ptr %a6160 %ai = getelementptr inbounds float, ptr %a, i32 %i161 store volatile float undef, ptr %ai162 ret void163}164 165define void @testdouble(ptr %a, i32 %i) {166; RVI-LABEL: 'testdouble'167; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds double, ptr %a, i32 1168; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a1, align 8169; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds double, ptr %a, i32 -1170; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a2, align 8171; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds double, ptr %a, i32 255172; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a3, align 8173; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds double, ptr %a, i32 256174; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a4, align 8175; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds double, ptr %a, i32 -256176; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a5, align 8177; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds double, ptr %a, i32 -257178; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a6, align 8179; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds double, ptr %a, i32 %i180; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %ai, align 8181; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void182;183 %a1 = getelementptr inbounds double, ptr %a, i32 1184 store volatile double undef, ptr %a1185 %a2 = getelementptr inbounds double, ptr %a, i32 -1186 store volatile double undef, ptr %a2187 %a3 = getelementptr inbounds double, ptr %a, i32 255188 store volatile double undef, ptr %a3189 %a4 = getelementptr inbounds double, ptr %a, i32 256190 store volatile double undef, ptr %a4191 %a5 = getelementptr inbounds double, ptr %a, i32 -256192 store volatile double undef, ptr %a5193 %a6 = getelementptr inbounds double, ptr %a, i32 -257194 store volatile double undef, ptr %a6195 %ai = getelementptr inbounds double, ptr %a, i32 %i196 store volatile double undef, ptr %ai197 ret void198}199 200define void @testvecs(i32 %i) {201; RVI-LABEL: 'testvecs'202; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b0 = getelementptr inbounds <4 x i8>, ptr undef, i32 1203; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i8> undef, ptr %b0, align 4204; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b1 = getelementptr inbounds <4 x i16>, ptr undef, i32 1205; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i16> undef, ptr %b1, align 8206; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b2 = getelementptr inbounds <4 x i32>, ptr undef, i32 1207; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i32> undef, ptr %b2, align 16208; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b3 = getelementptr inbounds <4 x i64>, ptr undef, i32 1209; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store volatile <4 x i64> undef, ptr %b3, align 32210; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b4 = getelementptr inbounds <4 x float>, ptr undef, i32 1211; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x float> undef, ptr %b4, align 16212; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b5 = getelementptr inbounds <4 x double>, ptr undef, i32 1213; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store volatile <4 x double> undef, ptr %b5, align 32214; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c1 = getelementptr inbounds <4 x i8>, ptr undef, i32 128215; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i8> undef, ptr %c1, align 4216; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c2 = getelementptr inbounds <4 x i16>, ptr undef, i32 128217; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i16> undef, ptr %c2, align 8218; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c3 = getelementptr inbounds <4 x i32>, ptr undef, i32 128219; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i32> undef, ptr %c3, align 16220; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c4 = getelementptr inbounds <4 x i64>, ptr undef, i32 128221; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store volatile <4 x i64> undef, ptr %c4, align 32222; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c5 = getelementptr inbounds <4 x float>, ptr undef, i32 128223; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x float> undef, ptr %c5, align 16224; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c6 = getelementptr inbounds <4 x double>, ptr undef, i32 128225; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store volatile <4 x double> undef, ptr %c6, align 32226; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void227;228 229 %b0 = getelementptr inbounds <4 x i8>, ptr undef, i32 1230 store volatile <4 x i8> undef, ptr %b0231 %b1 = getelementptr inbounds <4 x i16>, ptr undef, i32 1232 store volatile <4 x i16> undef, ptr %b1233 %b2 = getelementptr inbounds <4 x i32>, ptr undef, i32 1234 store volatile <4 x i32> undef, ptr %b2235 %b3 = getelementptr inbounds <4 x i64>, ptr undef, i32 1236 store volatile <4 x i64> undef, ptr %b3237 %b4 = getelementptr inbounds <4 x float>, ptr undef, i32 1238 store volatile <4 x float> undef, ptr %b4239 %b5 = getelementptr inbounds <4 x double>, ptr undef, i32 1240 store volatile <4 x double> undef, ptr %b5241 242 %c1 = getelementptr inbounds <4 x i8>, ptr undef, i32 128243 store volatile <4 x i8> undef, ptr %c1244 %c2 = getelementptr inbounds <4 x i16>, ptr undef, i32 128245 store volatile <4 x i16> undef, ptr %c2246 %c3 = getelementptr inbounds <4 x i32>, ptr undef, i32 128247 store volatile <4 x i32> undef, ptr %c3248 %c4 = getelementptr inbounds <4 x i64>, ptr undef, i32 128249 store volatile <4 x i64> undef, ptr %c4250 %c5 = getelementptr inbounds <4 x float>, ptr undef, i32 128251 store volatile <4 x float> undef, ptr %c5252 %c6 = getelementptr inbounds <4 x double>, ptr undef, i32 128253 store volatile <4 x double> undef, ptr %c6254 255 ret void256}257 258; Ensure that memory operations of a different type than the pointer source type259; use the correct type to determine if folding is possible. These operations260; are on vector types so there should be a cost for the GEP as the offset cannot261; be folded into the instruction.262define void @non_foldable_vector_uses(ptr %base, <2 x ptr> %base.vec) {263; RVI-LABEL: 'non_foldable_vector_uses'264; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = getelementptr i8, ptr %base, i32 42265; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x1 = load volatile <2 x i8>, ptr %1, align 2266; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = getelementptr i8, ptr %base, i32 42267; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x2 = call <2 x i8> @llvm.masked.load.v2i8.p0(ptr align 1 %2, <2 x i1> undef, <2 x i8> undef)268; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %3 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 42, i32 43>269; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %x3 = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> align 1 %3, <2 x i1> undef, <2 x i8> undef)270; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %4 = getelementptr i8, ptr %base, i32 42271; RVI-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %x4 = call <2 x i8> @llvm.masked.expandload.v2i8(ptr %4, <2 x i1> undef, <2 x i8> undef)272; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %5 = getelementptr i8, ptr %base, i32 42273; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x5 = call <2 x i8> @llvm.vp.load.v2i8.p0(ptr %5, <2 x i1> undef, i32 undef)274; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %6 = getelementptr i8, ptr %base, i32 42275; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %x6 = call <2 x i8> @llvm.experimental.vp.strided.load.v2i8.p0.i64(ptr %6, i64 undef, <2 x i1> undef, i32 undef)276; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %7 = getelementptr i8, ptr %base, i32 42277; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <2 x i8> undef, ptr %7, align 2278; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %8 = getelementptr i8, ptr %base, i32 42279; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.masked.store.v2i8.p0(<2 x i8> undef, ptr align 1 %8, <2 x i1> undef)280; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %9 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 42, i32 43>281; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.masked.scatter.v2i8.v2p0(<2 x i8> undef, <2 x ptr> align 1 %9, <2 x i1> undef)282; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %10 = getelementptr i8, ptr %base, i32 42283; RVI-NEXT: Cost Model: Found an estimated cost of 3 for instruction: call void @llvm.masked.compressstore.v2i8(<2 x i8> undef, ptr %10, <2 x i1> undef)284; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %11 = getelementptr i8, ptr %base, i32 42285; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.vp.store.v2i8.p0(<2 x i8> undef, ptr %11, <2 x i1> undef, i32 undef)286; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %12 = getelementptr i8, ptr %base, i32 42287; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.experimental.vp.strided.store.v2i8.p0.i64(<2 x i8> undef, ptr %12, i64 undef, <2 x i1> undef, i32 undef)288; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void289;290 %1 = getelementptr i8, ptr %base, i32 42291 %x1 = load volatile <2 x i8>, ptr %1292 293 %2 = getelementptr i8, ptr %base, i32 42294 %x2 = call <2 x i8> @llvm.masked.load.v2i8.p0(ptr %2, i32 1, <2 x i1> undef, <2 x i8> undef)295 296 %3 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 42, i32 43>297 %x3 = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> %3, i32 1, <2 x i1> undef, <2 x i8> undef)298 299 %4 = getelementptr i8, ptr %base, i32 42300 %x4 = call <2 x i8> @llvm.masked.expandload.v2i8(ptr %4, <2 x i1> undef, <2 x i8> undef)301 302 %5 = getelementptr i8, ptr %base, i32 42303 %x5 = call <2 x i8> @llvm.vp.load.v2i8.p0(ptr %5, <2 x i1> undef, i32 undef)304 305 %6 = getelementptr i8, ptr %base, i32 42306 %x6 = call <2 x i8> @llvm.experimental.vp.strided.load.v2i8.i64(ptr %6, i64 undef, <2 x i1> undef, i32 undef)307 308 %7 = getelementptr i8, ptr %base, i32 42309 store volatile <2 x i8> undef, ptr %7310 311 %8 = getelementptr i8, ptr %base, i32 42312 call void @llvm.masked.store.v2i8.p0(<2 x i8> undef, ptr %8, i32 1, <2 x i1> undef)313 314 %9 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 42, i32 43>315 call void @llvm.masked.scatter.v2i8.v2p0(<2 x i8> undef, <2 x ptr> %9, i32 1, <2 x i1> undef)316 317 %10 = getelementptr i8, ptr %base, i32 42318 call void @llvm.masked.compressstore.v2i8(<2 x i8> undef, ptr %10, <2 x i1> undef)319 320 %11 = getelementptr i8, ptr %base, i32 42321 call void @llvm.vp.store.v2i8.p0(<2 x i8> undef, ptr %11, <2 x i1> undef, i32 undef)322 323 %12 = getelementptr i8, ptr %base, i32 42324 call void @llvm.experimental.vp.strided.store.v2i8.i64(<2 x i8> undef, ptr %12, i64 undef, <2 x i1> undef, i32 undef)325 326 ret void327}328 329; Despite the fact that these are vector loads and stores which doesn't allow an330; offset in the addressing mode, because the offsets are zero we don't actually331; need to do any calculation for the GEP and thus it should be free.332define void @foldable_vector_uses(ptr %base, <2 x ptr> %base.vec) {333; RVI-LABEL: 'foldable_vector_uses'334; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %1 = getelementptr i8, ptr %base, i32 0335; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x1 = load volatile <2 x i8>, ptr %1, align 2336; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %2 = getelementptr i8, ptr %base, i32 0337; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x2 = call <2 x i8> @llvm.masked.load.v2i8.p0(ptr align 1 %2, <2 x i1> undef, <2 x i8> undef)338; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %3 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> zeroinitializer339; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %x3 = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> align 1 %3, <2 x i1> undef, <2 x i8> undef)340; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %4 = getelementptr i8, ptr %base, i32 0341; RVI-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %x4 = call <2 x i8> @llvm.masked.expandload.v2i8(ptr %4, <2 x i1> undef, <2 x i8> undef)342; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %5 = getelementptr i8, ptr %base, i32 0343; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x5 = call <2 x i8> @llvm.vp.load.v2i8.p0(ptr %5, <2 x i1> undef, i32 undef)344; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %6 = getelementptr i8, ptr %base, i32 0345; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %x6 = call <2 x i8> @llvm.experimental.vp.strided.load.v2i8.p0.i64(ptr %6, i64 undef, <2 x i1> undef, i32 undef)346; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %7 = getelementptr i8, ptr %base, i32 0347; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <2 x i8> undef, ptr %7, align 2348; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %8 = getelementptr i8, ptr %base, i32 0349; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.masked.store.v2i8.p0(<2 x i8> undef, ptr align 1 %8, <2 x i1> undef)350; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %9 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> zeroinitializer351; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.masked.scatter.v2i8.v2p0(<2 x i8> undef, <2 x ptr> align 1 %9, <2 x i1> undef)352; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %10 = getelementptr i8, ptr %base, i32 0353; RVI-NEXT: Cost Model: Found an estimated cost of 3 for instruction: call void @llvm.masked.compressstore.v2i8(<2 x i8> undef, ptr %10, <2 x i1> undef)354; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %11 = getelementptr i8, ptr %base, i32 0355; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.vp.store.v2i8.p0(<2 x i8> undef, ptr %11, <2 x i1> undef, i32 undef)356; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %12 = getelementptr i8, ptr %base, i32 0357; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.experimental.vp.strided.store.v2i8.p0.i64(<2 x i8> undef, ptr %12, i64 undef, <2 x i1> undef, i32 undef)358; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void359;360 %1 = getelementptr i8, ptr %base, i32 0361 %x1 = load volatile <2 x i8>, ptr %1362 363 %2 = getelementptr i8, ptr %base, i32 0364 %x2 = call <2 x i8> @llvm.masked.load.v2i8.p0(ptr %2, i32 1, <2 x i1> undef, <2 x i8> undef)365 366 %3 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 0, i32 0>367 %x3 = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> %3, i32 1, <2 x i1> undef, <2 x i8> undef)368 369 %4 = getelementptr i8, ptr %base, i32 0370 %x4 = call <2 x i8> @llvm.masked.expandload.v2i8(ptr %4, <2 x i1> undef, <2 x i8> undef)371 372 %5 = getelementptr i8, ptr %base, i32 0373 %x5 = call <2 x i8> @llvm.vp.load.v2i8.p0(ptr %5, <2 x i1> undef, i32 undef)374 375 %6 = getelementptr i8, ptr %base, i32 0376 %x6 = call <2 x i8> @llvm.experimental.vp.strided.load.v2i8.i64(ptr %6, i64 undef, <2 x i1> undef, i32 undef)377 378 %7 = getelementptr i8, ptr %base, i32 0379 store volatile <2 x i8> undef, ptr %7380 381 %8 = getelementptr i8, ptr %base, i32 0382 call void @llvm.masked.store.v2i8.p0(<2 x i8> undef, ptr %8, i32 1, <2 x i1> undef)383 384 %9 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 0, i32 0>385 call void @llvm.masked.scatter.v2i8.v2p0(<2 x i8> undef, <2 x ptr> %9, i32 1, <2 x i1> undef)386 387 %10 = getelementptr i8, ptr %base, i32 0388 call void @llvm.masked.compressstore.v2i8(<2 x i8> undef, ptr %10, <2 x i1> undef)389 390 %11 = getelementptr i8, ptr %base, i32 0391 call void @llvm.vp.store.v2i8.p0(<2 x i8> undef, ptr %11, <2 x i1> undef, i32 undef)392 393 %12 = getelementptr i8, ptr %base, i32 0394 call void @llvm.experimental.vp.strided.store.v2i8.i64(<2 x i8> undef, ptr %12, i64 undef, <2 x i1> undef, i32 undef)395 396 ret void397}398 399