154 lines · plain
1; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s2; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z17 | FileCheck %s -check-prefix=Z173;4; Note: The scalarized vector instructions costs are not including any5; extracts, due to the undef operands.6 7define void @add() {8 %res0 = add i8 undef, undef9 %res1 = add i16 undef, undef10 %res2 = add i32 undef, undef11 %res3 = add i64 undef, undef12 %resQ = add i128 undef, undef13 %res4 = add <2 x i8> undef, undef14 %res5 = add <2 x i16> undef, undef15 %res6 = add <2 x i32> undef, undef16 %res7 = add <2 x i64> undef, undef17 %res8 = add <4 x i8> undef, undef18 %res9 = add <4 x i16> undef, undef19 %res10 = add <4 x i32> undef, undef20 %res11 = add <4 x i64> undef, undef21 %res12 = add <8 x i8> undef, undef22 %res13 = add <8 x i16> undef, undef23 %res14 = add <8 x i32> undef, undef24 %res15 = add <8 x i64> undef, undef25 %res16 = add <16 x i8> undef, undef26 %res17 = add <16 x i16> undef, undef27 %res18 = add <16 x i32> undef, undef28 %res19 = add <16 x i64> undef, undef29 30; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res0 = add i8 undef, undef31; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res1 = add i16 undef, undef32; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res2 = add i32 undef, undef33; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res3 = add i64 undef, undef34; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %resQ = add i128 undef, undef35; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res4 = add <2 x i8> undef, undef36; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res5 = add <2 x i16> undef, undef37; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res6 = add <2 x i32> undef, undef38; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res7 = add <2 x i64> undef, undef39; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res8 = add <4 x i8> undef, undef40; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res9 = add <4 x i16> undef, undef41; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res10 = add <4 x i32> undef, undef42; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res11 = add <4 x i64> undef, undef43; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res12 = add <8 x i8> undef, undef44; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res13 = add <8 x i16> undef, undef45; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res14 = add <8 x i32> undef, undef46; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res15 = add <8 x i64> undef, undef47; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res16 = add <16 x i8> undef, undef48; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res17 = add <16 x i16> undef, undef49; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res18 = add <16 x i32> undef, undef50; CHECK: Cost Model: Found an estimated cost of 8 for instruction: %res19 = add <16 x i64> undef, undef51 52 ret void;53}54 55define void @sub() {56 %res0 = sub i8 undef, undef57 %res1 = sub i16 undef, undef58 %res2 = sub i32 undef, undef59 %res3 = sub i64 undef, undef60 %resQ = sub i128 undef, undef61 %res4 = sub <2 x i8> undef, undef62 %res5 = sub <2 x i16> undef, undef63 %res6 = sub <2 x i32> undef, undef64 %res7 = sub <2 x i64> undef, undef65 %res8 = sub <4 x i8> undef, undef66 %res9 = sub <4 x i16> undef, undef67 %res10 = sub <4 x i32> undef, undef68 %res11 = sub <4 x i64> undef, undef69 %res12 = sub <8 x i8> undef, undef70 %res13 = sub <8 x i16> undef, undef71 %res14 = sub <8 x i32> undef, undef72 %res15 = sub <8 x i64> undef, undef73 %res16 = sub <16 x i8> undef, undef74 %res17 = sub <16 x i16> undef, undef75 %res18 = sub <16 x i32> undef, undef76 %res19 = sub <16 x i64> undef, undef77 78; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res0 = sub i8 undef, undef79; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res1 = sub i16 undef, undef80; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res2 = sub i32 undef, undef81; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res3 = sub i64 undef, undef82; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %resQ = sub i128 undef, undef83; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res4 = sub <2 x i8> undef, undef84; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res5 = sub <2 x i16> undef, undef85; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res6 = sub <2 x i32> undef, undef86; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res7 = sub <2 x i64> undef, undef87; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res8 = sub <4 x i8> undef, undef88; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res9 = sub <4 x i16> undef, undef89; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res10 = sub <4 x i32> undef, undef90; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res11 = sub <4 x i64> undef, undef91; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res12 = sub <8 x i8> undef, undef92; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res13 = sub <8 x i16> undef, undef93; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res14 = sub <8 x i32> undef, undef94; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res15 = sub <8 x i64> undef, undef95; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res16 = sub <16 x i8> undef, undef96; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res17 = sub <16 x i16> undef, undef97; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res18 = sub <16 x i32> undef, undef98; CHECK: Cost Model: Found an estimated cost of 8 for instruction: %res19 = sub <16 x i64> undef, undef99 100 ret void;101}102 103define void @mul() {104 %res0 = mul i8 undef, undef105 %res1 = mul i16 undef, undef106 %res2 = mul i32 undef, undef107 %res3 = mul i64 undef, undef108 %resQ = mul i128 undef, undef109 %res4 = mul <2 x i8> undef, undef110 %res5 = mul <2 x i16> undef, undef111 %res6 = mul <2 x i32> undef, undef112 %res7 = mul <2 x i64> undef, undef113 %res8 = mul <4 x i8> undef, undef114 %res9 = mul <4 x i16> undef, undef115 %res10 = mul <4 x i32> undef, undef116 %res11 = mul <4 x i64> undef, undef117 %res12 = mul <8 x i8> undef, undef118 %res13 = mul <8 x i16> undef, undef119 %res14 = mul <8 x i32> undef, undef120 %res15 = mul <8 x i64> undef, undef121 %res16 = mul <16 x i8> undef, undef122 %res17 = mul <16 x i16> undef, undef123 %res18 = mul <16 x i32> undef, undef124 %res19 = mul <16 x i64> undef, undef125 126; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res0 = mul i8 undef, undef127; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res1 = mul i16 undef, undef128; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res2 = mul i32 undef, undef129; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res3 = mul i64 undef, undef130; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %resQ = mul i128 undef, undef131; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res4 = mul <2 x i8> undef, undef132; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res5 = mul <2 x i16> undef, undef133; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res6 = mul <2 x i32> undef, undef134; CHECK: Cost Model: Found an estimated cost of 3 for instruction: %res7 = mul <2 x i64> undef, undef135; Z17: Cost Model: Found an estimated cost of 1 for instruction: %res7 = mul <2 x i64> undef, undef136; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res8 = mul <4 x i8> undef, undef137; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res9 = mul <4 x i16> undef, undef138; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res10 = mul <4 x i32> undef, undef139; CHECK: Cost Model: Found an estimated cost of 6 for instruction: %res11 = mul <4 x i64> undef, undef140; Z17: Cost Model: Found an estimated cost of 2 for instruction: %res11 = mul <4 x i64> undef, undef141; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res12 = mul <8 x i8> undef, undef142; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res13 = mul <8 x i16> undef, undef143; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res14 = mul <8 x i32> undef, undef144; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res15 = mul <8 x i64> undef, undef145; Z17: Cost Model: Found an estimated cost of 4 for instruction: %res15 = mul <8 x i64> undef, undef146; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res16 = mul <16 x i8> undef, undef147; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res17 = mul <16 x i16> undef, undef148; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res18 = mul <16 x i32> undef, undef149; CHECK: Cost Model: Found an estimated cost of 24 for instruction: %res19 = mul <16 x i64> undef, undef150; Z17: Cost Model: Found an estimated cost of 8 for instruction: %res19 = mul <16 x i64> undef, undef151 152 ret void;153}154