brintos

brintos / llvm-project-archived public Read only

0
0
Text · 37.5 KiB · 38fa32d Raw
768 lines · plain
1; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 \2; RUN:  | FileCheck %s -check-prefixes=CHECK,Z133; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z14 \4; RUN:  | FileCheck %s -check-prefixes=CHECK,Z145;6; Test that loads into operations that can fold one memory operand get zero7; cost. In the case that both operands are loaded, one load should get a cost8; value.9 10define void @add() {11  %li32 = load i32, ptr undef12  add i32 %li32, undef13 14  %li32_0 = load i32, ptr undef15  %li32_1 = load i32, ptr undef16  add i32 %li32_0, %li32_117 18  %li64 = load i64, ptr undef19  add i64 %li64, undef20 21  %li64_0 = load i64, ptr undef22  %li64_1 = load i64, ptr undef23  add i64 %li64_0, %li64_124 25  ; Truncated load26  %li64_2 = load i64, ptr undef27  %tr = trunc i64 %li64_2 to i3228  add i32 %tr, undef29 30  ; Sign-extended loads31  %li16_0 = load i16, ptr undef32  %sext_0 = sext i16 %li16_0 to i3233  add i32 %sext_0, undef34 35  %li16_1 = load i16, ptr undef36  %sext_1 = sext i16 %li16_1 to i6437  add i64 %sext_1, undef38 39  %li32_2 = load i32, ptr undef40  %sext_2 = sext i32 %li32_2 to i6441  add i64 %sext_2, undef42 43  ; Zero-extended loads44  %li32_3 = load i32, ptr undef45  %zext_0 = zext i32 %li32_3 to i6446  add i64 %zext_0, undef47 48  ; Loads with multiple uses are *not* folded49  %li16_3 = load i16, ptr undef50  %sext_3 = sext i16 %li16_3 to i3251  %sext_4 = sext i16 %li16_3 to i3252  add i32 %sext_3, undef53 54  ret void;55 56; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32 = load i32, ptr undef57; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %1 = add i32 %li32, undef58; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_0 = load i32, ptr undef59; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_1 = load i32, ptr undef60; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %2 = add i32 %li32_0, %li32_161; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64 = load i64, ptr undef62; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %3 = add i64 %li64, undef63; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_0 = load i64, ptr undef64; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_1 = load i64, ptr undef65; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = add i64 %li64_0, %li64_166; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_2 = load i64, ptr undef67; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr = trunc i64 %li64_2 to i3268; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %5 = add i32 %tr, undef69; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li16_0 = load i16, ptr undef70; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_0 = sext i16 %li16_0 to i3271; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %6 = add i32 %sext_0, undef72; Z13:   Cost Model: Found an estimated cost of 1 for instruction:   %li16_1 = load i16, ptr undef73; Z14:   Cost Model: Found an estimated cost of 0 for instruction:   %li16_1 = load i16, ptr undef74; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_1 = sext i16 %li16_1 to i6475; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %7 = add i64 %sext_1, undef76; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_2 = load i32, ptr undef77; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_2 = sext i32 %li32_2 to i6478; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %8 = add i64 %sext_2, undef79; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_3 = load i32, ptr undef80; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %zext_0 = zext i32 %li32_3 to i6481; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %9 = add i64 %zext_0, undef82; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16_3 = load i16, ptr undef83; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_3 = sext i16 %li16_3 to i3284; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_4 = sext i16 %li16_3 to i3285; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %10 = add i32 %sext_3, undef86}87 88define void @add_i16_mem16(i16 %Arg, ptr %Src1, ptr %Src2, ptr %Dst, ptr %Src32) {89  %L1 = load i16, ptr %Src190  %S0 = add i16 %L1, %Arg91  store volatile i16 %S0, ptr %Dst92 93  %L2 = load i16, ptr %Src194  %L3 = load i16, ptr %Src295  %S1 = add i16 %L2, %L396  store volatile i16 %S1, ptr %Dst97 98  ; Truncated load99  %L32 = load i32, ptr %Src32100  %tr = trunc i32 %L32 to i16101  %S2 = add i16 %tr, %Arg102  store volatile i16 %S2, ptr %Dst103 104  ret void105; CHECK: function 'add_i16_mem16'106; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %L1 = load i16, ptr %Src1107; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %S0 = add i16 %L1, %Arg108; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   store volatile i16 %S0, ptr %Dst109; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %L2 = load i16, ptr %Src1110; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %L3 = load i16, ptr %Src2111; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %S1 = add i16 %L2, %L3112; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   store volatile i16 %S1, ptr %Dst113; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %L32 = load i32, ptr %Src32114; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr = trunc i32 %L32 to i16115; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %S2 = add i16 %tr, %Arg116; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   store volatile i16 %S2, ptr %Dst117}118 119define void @sub_lhs_mem() {120  %li32 = load i32, ptr undef121  sub i32 %li32, undef122 123  %li32_0 = load i32, ptr undef124  %li32_1 = load i32, ptr undef125  sub i32 %li32_0, %li32_1126 127  %li64 = load i64, ptr undef128  sub i64 %li64, undef129 130  %li64_0 = load i64, ptr undef131  %li64_1 = load i64, ptr undef132  sub i64 %li64_0, %li64_1133 134  ; Truncated load135  %li64_2 = load i64, ptr undef136  %tr = trunc i64 %li64_2 to i32137  sub i32 %tr, undef138 139  ; Sign-extended loads140  %li16_0 = load i16, ptr undef141  %sext_0 = sext i16 %li16_0 to i32142  sub i32 %sext_0, undef143 144  %li16_1 = load i16, ptr undef145  %sext_1 = sext i16 %li16_1 to i64146  sub i64 %sext_1, undef147 148  %li32_2 = load i32, ptr undef149  %sext_2 = sext i32 %li32_2 to i64150  sub i64 %sext_2, undef151 152  ; Zero-extended loads153  %li32_3 = load i32, ptr undef154  %zext_0 = zext i32 %li32_3 to i64155  sub i64 %zext_0, undef156 157  ; Loads with multiple uses are *not* folded158  %li16_3 = load i16, ptr undef159  %sext_3 = sext i16 %li16_3 to i32160  %sext_4 = sext i16 %li16_3 to i32161  sub i32 %sext_3, undef162 163  ret void;164 165; A sub LHS loaded operand is *not* foldable.166; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32 = load i32, ptr undef167; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %1 = sub i32 %li32, undef168; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_0 = load i32, ptr undef169; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_1 = load i32, ptr undef170; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %2 = sub i32 %li32_0, %li32_1171; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64 = load i64, ptr undef172; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %3 = sub i64 %li64, undef173; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_0 = load i64, ptr undef174; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_1 = load i64, ptr undef175; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = sub i64 %li64_0, %li64_1176; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_2 = load i64, ptr undef177; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr = trunc i64 %li64_2 to i32178; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %5 = sub i32 %tr, undef179; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16_0 = load i16, ptr undef180; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_0 = sext i16 %li16_0 to i32181; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %6 = sub i32 %sext_0, undef182; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16_1 = load i16, ptr undef183; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_1 = sext i16 %li16_1 to i64184; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %7 = sub i64 %sext_1, undef185; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_2 = load i32, ptr undef186; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_2 = sext i32 %li32_2 to i64187; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %8 = sub i64 %sext_2, undef188; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_3 = load i32, ptr undef189; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %zext_0 = zext i32 %li32_3 to i64190; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %9 = sub i64 %zext_0, undef191; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16_3 = load i16, ptr undef192; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_3 = sext i16 %li16_3 to i32193; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_4 = sext i16 %li16_3 to i32194; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %10 = sub i32 %sext_3, undef195}196 197define void @sub_rhs_mem() {198  %li32 = load i32, ptr undef199  sub i32 undef, %li32200 201  %li64 = load i64, ptr undef202  sub i64 undef, %li64203 204  ; Truncated load205  %li64_2 = load i64, ptr undef206  %tr = trunc i64 %li64_2 to i32207  sub i32 undef, %tr208 209  ; Sign-extended loads210  %li16_0 = load i16, ptr undef211  %sext_0 = sext i16 %li16_0 to i32212  sub i32 undef, %sext_0213 214  %li16_1 = load i16, ptr undef215  %sext_1 = sext i16 %li16_1 to i64216  sub i64 undef, %sext_1217 218  %li32_2 = load i32, ptr undef219  %sext_2 = sext i32 %li32_2 to i64220  sub i64 undef, %sext_2221 222  ; Zero-extended loads223  %li32_3 = load i32, ptr undef224  %zext_0 = zext i32 %li32_3 to i64225  sub i64 undef, %zext_0226 227  ; Loads with multiple uses are *not* folded228  %li16_3 = load i16, ptr undef229  %sext_3 = sext i16 %li16_3 to i32230  %sext_4 = sext i16 %li16_3 to i32231  sub i32 undef, %sext_3232 233  ret void;234 235; A sub RHS loaded operand is foldable.236; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32 = load i32, ptr undef237; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %1 = sub i32 undef, %li32238; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64 = load i64, ptr undef239; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %2 = sub i64 undef, %li64240; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_2 = load i64, ptr undef241; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr = trunc i64 %li64_2 to i32242; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %3 = sub i32 undef, %tr243; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li16_0 = load i16, ptr undef244; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_0 = sext i16 %li16_0 to i32245; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = sub i32 undef, %sext_0246; Z13:   Cost Model: Found an estimated cost of 1 for instruction:   %li16_1 = load i16, ptr undef247; Z14:   Cost Model: Found an estimated cost of 0 for instruction:   %li16_1 = load i16, ptr undef248; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_1 = sext i16 %li16_1 to i64249; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %5 = sub i64 undef, %sext_1250; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_2 = load i32, ptr undef251; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_2 = sext i32 %li32_2 to i64252; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %6 = sub i64 undef, %sext_2253; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_3 = load i32, ptr undef254; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %zext_0 = zext i32 %li32_3 to i64255; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %7 = sub i64 undef, %zext_0256; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16_3 = load i16, ptr undef257; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_3 = sext i16 %li16_3 to i32258; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_4 = sext i16 %li16_3 to i32259; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %8 = sub i32 undef, %sext_3260}261 262define void @sub_i16_mem16(i16 %Arg, ptr %Src1, ptr %Src2, ptr %Dst, ptr %Src32) {263  %L1 = load i16, ptr %Src1264  %D0 = sub i16 %Arg, %L1265  store volatile i16 %D0, ptr %Dst266 267  %L2 = load i16, ptr %Src1268  %L3 = load i16, ptr %Src2269  %D1 = sub i16 %L2, %L3270  store volatile i16 %D1, ptr %Dst271 272  ; Truncated load273  %L32 = load i32, ptr %Src32274  %tr = trunc i32 %L32 to i16275  %D2 = sub i16 %Arg, %tr276  store volatile i16 %D2, ptr %Dst277 278  ret void279; CHECK: function 'sub_i16_mem16'280; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %L1 = load i16, ptr %Src1281; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %D0 = sub i16 %Arg, %L1282; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   store volatile i16 %D0, ptr %Dst283; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %L2 = load i16, ptr %Src1284; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %L3 = load i16, ptr %Src2285; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %D1 = sub i16 %L2, %L3286; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   store volatile i16 %D1, ptr %Dst287; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %L32 = load i32, ptr %Src32288; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr = trunc i32 %L32 to i16289; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %D2 = sub i16 %Arg, %tr290; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   store volatile i16 %D2, ptr %Dst291}292 293define void @mul() {294  %li32 = load i32, ptr undef295  mul i32 %li32, undef296 297  %li32_0 = load i32, ptr undef298  %li32_1 = load i32, ptr undef299  mul i32 %li32_0, %li32_1300 301  %li64 = load i64, ptr undef302  mul i64 %li64, undef303 304  %li64_0 = load i64, ptr undef305  %li64_1 = load i64, ptr undef306  mul i64 %li64_0, %li64_1307 308  ; Truncated load309  %li64_2 = load i64, ptr undef310  %tr = trunc i64 %li64_2 to i32311  mul i32 %tr, undef312 313  ; Sign-extended loads314  %li16_0 = load i16, ptr undef315  %sext_0 = sext i16 %li16_0 to i32316  mul i32 %sext_0, undef317 318  %li16_1 = load i16, ptr undef319  %sext_1 = sext i16 %li16_1 to i64320  mul i64 %sext_1, undef321 322  %li32_2 = load i32, ptr undef323  %sext_2 = sext i32 %li32_2 to i64324  mul i64 %sext_2, undef325 326  ; Zero-extended loads are *not* folded327  %li16_2 = load i16, ptr undef328  %zext_0 = zext i16 %li16_2 to i32329  mul i32 %zext_0, undef330 331  ; Loads with multiple uses are *not* folded332  %li16_3 = load i16, ptr undef333  %sext_3 = sext i16 %li16_3 to i32334  %sext_4 = sext i16 %li16_3 to i32335  mul i32 %sext_3, undef336 337  ret void;338; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32 = load i32, ptr undef339; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %1 = mul i32 %li32, undef340; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_0 = load i32, ptr undef341; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_1 = load i32, ptr undef342; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %2 = mul i32 %li32_0, %li32_1343; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64 = load i64, ptr undef344; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %3 = mul i64 %li64, undef345; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_0 = load i64, ptr undef346; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_1 = load i64, ptr undef347; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = mul i64 %li64_0, %li64_1348; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_2 = load i64, ptr undef349; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr = trunc i64 %li64_2 to i32350; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %5 = mul i32 %tr, undef351; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li16_0 = load i16, ptr undef352; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_0 = sext i16 %li16_0 to i32353; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %6 = mul i32 %sext_0, undef354; Z13:   Cost Model: Found an estimated cost of 1 for instruction:   %li16_1 = load i16, ptr undef355; Z14:   Cost Model: Found an estimated cost of 0 for instruction:   %li16_1 = load i16, ptr undef356; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_1 = sext i16 %li16_1 to i64357; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %7 = mul i64 %sext_1, undef358; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_2 = load i32, ptr undef359; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_2 = sext i32 %li32_2 to i64360; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %8 = mul i64 %sext_2, undef361; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16_2 = load i16, ptr undef362; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %zext_0 = zext i16 %li16_2 to i32363; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %9 = mul i32 %zext_0, undef364; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16_3 = load i16, ptr undef365; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_3 = sext i16 %li16_3 to i32366; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_4 = sext i16 %li16_3 to i32367; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %10 = mul i32 %sext_3, undef368}369 370define void @mul_i16_mem16(i16 %Arg, ptr %Src1, ptr %Src2, ptr %Dst, ptr %Src32) {371  %L1 = load i16, ptr %Src1372  %P0 = mul i16 %Arg, %L1373  store volatile i16 %P0, ptr %Dst374 375  %L2 = load i16, ptr %Src1376  %L3 = load i16, ptr %Src2377  %P1 = mul i16 %L2, %L3378  store volatile i16 %P1, ptr %Dst379 380  ; Truncated load381  %L32 = load i32, ptr %Src32382  %tr = trunc i32 %L32 to i16383  %P2 = mul i16 %Arg, %tr384  store volatile i16 %P2, ptr %Dst385 386  ret void387; CHECK: function 'mul_i16_mem16'388; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %L1 = load i16, ptr %Src1389; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %P0 = mul i16 %Arg, %L1390; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   store volatile i16 %P0, ptr %Dst391; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %L2 = load i16, ptr %Src1392; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %L3 = load i16, ptr %Src2393; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %P1 = mul i16 %L2, %L3394; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   store volatile i16 %P1, ptr %Dst395; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %L32 = load i32, ptr %Src32396; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr = trunc i32 %L32 to i16397; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %P2 = mul i16 %Arg, %tr398; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   store volatile i16 %P2, ptr %Dst399}400 401define void @sdiv_lhs(i32 %arg32, i64 %arg64) {402  %li32 = load i32, ptr undef403  sdiv i32 %li32, %arg32404 405  %li32_0 = load i32, ptr undef406  %li32_1 = load i32, ptr undef407  sdiv i32 %li32_0, %li32_1408 409  %li64 = load i64, ptr undef410  sdiv i64 %li64, %arg64411 412  %li64_0 = load i64, ptr undef413  %li64_1 = load i64, ptr undef414  sdiv i64 %li64_0, %li64_1415 416  ; Truncated load417  %li64_2 = load i64, ptr undef418  %tr = trunc i64 %li64_2 to i32419  sdiv i32 %tr, undef420 421  ; Sign-extended loads422  %li32_2 = load i32, ptr undef423  %sext_0 = sext i32 %li32_2 to i64424  sdiv i64 %sext_0, undef425 426  ; Loads with multiple uses are *not* folded427  %li32_3 = load i32, ptr undef428  %sext_1 = sext i32 %li32_3 to i64429  %sext_2 = sext i32 %li32_3 to i64430  sdiv i64 %sext_1, undef431 432  ret void;433 434; An sdiv loaded dividend (lhs) operand is *not* foldable.435; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32 = load i32, ptr undef436; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %1 = sdiv i32 %li32, %arg32437; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_0 = load i32, ptr undef438; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_1 = load i32, ptr undef439; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %2 = sdiv i32 %li32_0, %li32_1440; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64 = load i64, ptr undef441; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %3 = sdiv i64 %li64, %arg64442; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_0 = load i64, ptr undef443; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_1 = load i64, ptr undef444; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %4 = sdiv i64 %li64_0, %li64_1445; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_2 = load i64, ptr undef446; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr = trunc i64 %li64_2 to i32447; CHECK: Cost Model: Found an estimated cost of 10 for instruction:   %5 = sdiv i32 %tr, undef448; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_2 = load i32, ptr undef449; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_0 = sext i32 %li32_2 to i64450; CHECK: Cost Model: Found an estimated cost of 10 for instruction:   %6 = sdiv i64 %sext_0, undef451; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_3 = load i32, ptr undef452; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_1 = sext i32 %li32_3 to i64453; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_2 = sext i32 %li32_3 to i64454; CHECK: Cost Model: Found an estimated cost of 10 for instruction:   %7 = sdiv i64 %sext_1, undef455}456 457define void @sdiv_rhs(i32 %arg32, i64 %arg64) {458  %li32 = load i32, ptr undef459  sdiv i32 %arg32, %li32460 461  %li64 = load i64, ptr undef462  sdiv i64 %arg64, %li64463 464  ; Truncated load465  %li64_2 = load i64, ptr undef466  %tr = trunc i64 %li64_2 to i32467  sdiv i32 undef, %tr468 469  ; Sign-extended loads470  %li32_2 = load i32, ptr undef471  %sext_0 = sext i32 %li32_2 to i64472  sdiv i64 undef, %sext_0473 474  ; Loads with multiple uses are *not* folded475  %li32_3 = load i32, ptr undef476  %sext_1 = sext i32 %li32_3 to i64477  %sext_2 = sext i32 %li32_3 to i64478  sdiv i64 undef, %sext_1479 480  ret void;481 482; An sdiv loaded divisor (rhs) operand is foldable.483; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32 = load i32, ptr undef484; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %1 = sdiv i32 %arg32, %li32485; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64 = load i64, ptr undef486; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %2 = sdiv i64 %arg64, %li64487; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_2 = load i64, ptr undef488; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr = trunc i64 %li64_2 to i32489; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %3 = sdiv i32 undef, %tr490; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_2 = load i32, ptr undef491; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_0 = sext i32 %li32_2 to i64492; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %4 = sdiv i64 undef, %sext_0493; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_3 = load i32, ptr undef494; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_1 = sext i32 %li32_3 to i64495; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext_2 = sext i32 %li32_3 to i64496; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %5 = sdiv i64 undef, %sext_1497}498 499define void @udiv_lhs(i32 %arg32, i64 %arg64) {500  %li32 = load i32, ptr undef501  udiv i32 %li32, %arg32502 503  %li32_0 = load i32, ptr undef504  %li32_1 = load i32, ptr undef505  udiv i32 %li32_0, %li32_1506 507  %li64 = load i64, ptr undef508  udiv i64 %li64, %arg64509 510  %li64_0 = load i64, ptr undef511  %li64_1 = load i64, ptr undef512  udiv i64 %li64_0, %li64_1513 514  ; Truncated load515  %li64_2 = load i64, ptr undef516  %tr_0 = trunc i64 %li64_2 to i32517  udiv i32 %tr_0, undef518 519  ; Loads with multiple uses are *not* folded520  %li64_3 = load i64, ptr undef521  %tr_1 = trunc i64 %li64_3 to i32522  udiv i64 %li64_3, undef523 524  ret void;525 526; An udiv loaded dividend (lhs) operand is *not* foldable.527; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32 = load i32, ptr undef528; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %1 = udiv i32 %li32, %arg32529; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_0 = load i32, ptr undef530; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_1 = load i32, ptr undef531; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %2 = udiv i32 %li32_0, %li32_1532; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64 = load i64, ptr undef533; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %3 = udiv i64 %li64, %arg64534; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_0 = load i64, ptr undef535; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_1 = load i64, ptr undef536; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %4 = udiv i64 %li64_0, %li64_1537; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_2 = load i64, ptr undef538; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_0 = trunc i64 %li64_2 to i32539; CHECK: Cost Model: Found an estimated cost of 10 for instruction:   %5 = udiv i32 %tr_0, undef540; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_3 = load i64, ptr undef541; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_1 = trunc i64 %li64_3 to i32542; CHECK: Cost Model: Found an estimated cost of 10 for instruction:   %6 = udiv i64 %li64_3, undef543}544 545define void @udiv_rhs(i32 %arg32, i64 %arg64) {546  %li32 = load i32, ptr undef547  udiv i32 %arg32, %li32548 549  %li64 = load i64, ptr undef550  udiv i64 %arg64, %li64551 552  ; Truncated load553  %li64_2 = load i64, ptr undef554  %tr_0 = trunc i64 %li64_2 to i32555  udiv i32 undef, %tr_0556 557  ; Loads with multiple uses are *not* folded558  %li64_3 = load i64, ptr undef559  %tr_1 = trunc i64 %li64_3 to i32560  udiv i64 undef, %li64_3561 562  ret void;563 564; An udiv loaded divisor (rhs) operand is foldable.565; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32 = load i32, ptr undef566; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %1 = udiv i32 %arg32, %li32567; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64 = load i64, ptr undef568; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %2 = udiv i64 %arg64, %li64569; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_2 = load i64, ptr undef570; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_0 = trunc i64 %li64_2 to i32571; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %3 = udiv i32 undef, %tr_0572; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_3 = load i64, ptr undef573; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_1 = trunc i64 %li64_3 to i32574; CHECK: Cost Model: Found an estimated cost of 20 for instruction:   %4 = udiv i64 undef, %li64_3575}576 577define void @and() {578  %li32 = load i32, ptr undef579  and i32 %li32, undef580 581  %li32_0 = load i32, ptr undef582  %li32_1 = load i32, ptr undef583  and i32 %li32_0, %li32_1584 585  %li64 = load i64, ptr undef586  and i64 %li64, undef587 588  %li64_0 = load i64, ptr undef589  %li64_1 = load i64, ptr undef590  and i64 %li64_0, %li64_1591 592  ; Truncated load593  %li64_2 = load i64, ptr undef594  %tr_0 = trunc i64 %li64_2 to i32595  and i32 %tr_0, undef596 597  ; Loads with multiple uses are *not* folded598  %li64_3 = load i64, ptr undef599  %tr_1 = trunc i64 %li64_3 to i32600  and i64 %li64_3, undef601 602  ret void;603; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32 = load i32, ptr undef604; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %1 = and i32 %li32, undef605; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_0 = load i32, ptr undef606; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_1 = load i32, ptr undef607; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %2 = and i32 %li32_0, %li32_1608; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64 = load i64, ptr undef609; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %3 = and i64 %li64, undef610; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_0 = load i64, ptr undef611; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_1 = load i64, ptr undef612; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = and i64 %li64_0, %li64_1613; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_2 = load i64, ptr undef614; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_0 = trunc i64 %li64_2 to i32615; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %5 = and i32 %tr_0, undef616; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_3 = load i64, ptr undef617; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_1 = trunc i64 %li64_3 to i32618; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %6 = and i64 %li64_3, undef619}620 621define void @or() {622  %li32 = load i32, ptr undef623  or i32 %li32, undef624 625  %li32_0 = load i32, ptr undef626  %li32_1 = load i32, ptr undef627  or i32 %li32_0, %li32_1628 629  %li64 = load i64, ptr undef630  or i64 %li64, undef631 632  %li64_0 = load i64, ptr undef633  %li64_1 = load i64, ptr undef634  or i64 %li64_0, %li64_1635 636  ; Truncated load637  %li64_2 = load i64, ptr undef638  %tr_0 = trunc i64 %li64_2 to i32639  or i32 %tr_0, undef640 641  ; Loads with multiple uses are *not* folded642  %li64_3 = load i64, ptr undef643  %tr_1 = trunc i64 %li64_3 to i32644  or i64 %li64_3, undef645 646  ret void;647; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32 = load i32, ptr undef648; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %1 = or i32 %li32, undef649; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_0 = load i32, ptr undef650; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_1 = load i32, ptr undef651; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %2 = or i32 %li32_0, %li32_1652; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64 = load i64, ptr undef653; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %3 = or i64 %li64, undef654; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_0 = load i64, ptr undef655; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_1 = load i64, ptr undef656; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = or i64 %li64_0, %li64_1657; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_2 = load i64, ptr undef658; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_0 = trunc i64 %li64_2 to i32659; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %5 = or i32 %tr_0, undef660; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_3 = load i64, ptr undef661; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_1 = trunc i64 %li64_3 to i32662; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %6 = or i64 %li64_3, undef663}664 665define void @xor() {666  %li32 = load i32, ptr undef667  xor i32 %li32, undef668 669  %li32_0 = load i32, ptr undef670  %li32_1 = load i32, ptr undef671  xor i32 %li32_0, %li32_1672 673  %li64 = load i64, ptr undef674  xor i64 %li64, undef675 676  %li64_0 = load i64, ptr undef677  %li64_1 = load i64, ptr undef678  xor i64 %li64_0, %li64_1679 680  ; Truncated load681  %li64_2 = load i64, ptr undef682  %tr_0 = trunc i64 %li64_2 to i32683  xor i32 %tr_0, undef684 685  ; Loads with multiple uses are *not* folded686  %li64_3 = load i64, ptr undef687  %tr_1 = trunc i64 %li64_3 to i32688  xor i64 %li64_3, undef689 690  ret void;691; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32 = load i32, ptr undef692; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %1 = xor i32 %li32, undef693; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_0 = load i32, ptr undef694; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_1 = load i32, ptr undef695; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %2 = xor i32 %li32_0, %li32_1696; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64 = load i64, ptr undef697; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %3 = xor i64 %li64, undef698; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_0 = load i64, ptr undef699; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_1 = load i64, ptr undef700; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = xor i64 %li64_0, %li64_1701; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_2 = load i64, ptr undef702; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_0 = trunc i64 %li64_2 to i32703; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %5 = xor i32 %tr_0, undef704; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_3 = load i64, ptr undef705; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_1 = trunc i64 %li64_3 to i32706; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %6 = xor i64 %li64_3, undef707}708 709define void @icmp() {710  %li32 = load i32, ptr undef711  icmp eq i32 %li32, undef712 713  %li32_0 = load i32, ptr undef714  %li32_1 = load i32, ptr undef715  icmp eq i32 %li32_0, %li32_1716 717  %li64 = load i64, ptr undef718  icmp eq i64 %li64, undef719 720  %li64_0 = load i64, ptr undef721  %li64_1 = load i64, ptr undef722  icmp eq i64 %li64_0, %li64_1723 724  ; Truncated load725  %li64_2 = load i64, ptr undef726  %tr_0 = trunc i64 %li64_2 to i32727  icmp eq i32 %tr_0, undef728 729  ; Sign-extended load730  %li32_2 = load i32, ptr undef731  %sext = sext i32 %li32_2 to i64732  icmp eq i64 %sext, undef733 734  ; Zero-extended load735  %li32_3 = load i32, ptr undef736  %zext = zext i32 %li32_3 to i64737  icmp eq i64 %zext, undef738 739  ; Loads with multiple uses are *not* folded740  %li64_3 = load i64, ptr undef741  %tr_1 = trunc i64 %li64_3 to i32742  icmp eq i64 %li64_3, undef743 744  ret void;745; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32 = load i32, ptr undef746; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %1 = icmp eq i32 %li32, undef747; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_0 = load i32, ptr undef748; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32_1 = load i32, ptr undef749; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %2 = icmp eq i32 %li32_0, %li32_1750; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64 = load i64, ptr undef751; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %3 = icmp eq i64 %li64, undef752; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_0 = load i64, ptr undef753; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_1 = load i64, ptr undef754; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = icmp eq i64 %li64_0, %li64_1755; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li64_2 = load i64, ptr undef756; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_0 = trunc i64 %li64_2 to i32757; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %5 = icmp eq i32 %tr_0, undef758; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_2 = load i32, ptr undef759; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %sext = sext i32 %li32_2 to i64760; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %6 = icmp eq i64 %sext, undef761; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %li32_3 = load i32, ptr undef762; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %zext = zext i32 %li32_3 to i64763; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %7 = icmp eq i64 %zext, undef764; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li64_3 = load i64, ptr undef765; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %tr_1 = trunc i64 %li64_3 to i32766; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %8 = icmp eq i64 %li64_3, undef767}768