57 lines · plain
1; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s2;3; Test that an extension of a load does not get an additional cost in cases4; where the load performs the extension.5 6define void @sext() {7 %li8 = load i8, ptr undef8 sext i8 %li8 to i169 sext i8 %li8 to i3210 sext i8 %li8 to i6411 12 %li16 = load i16, ptr undef13 sext i16 %li16 to i3214 sext i16 %li16 to i6415 16 %li32 = load i32, ptr undef17 sext i32 %li32 to i6418 19 ret void20 21; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li8 = load i8, ptr undef22; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %1 = sext i8 %li8 to i1623; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %2 = sext i8 %li8 to i3224; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %3 = sext i8 %li8 to i6425; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li16 = load i16, ptr undef26; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %4 = sext i16 %li16 to i3227; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %5 = sext i16 %li16 to i6428; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li32 = load i32, ptr undef29; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %6 = sext i32 %li32 to i6430}31 32define void @zext() {33 %li8 = load i8, ptr undef34 zext i8 %li8 to i1635 zext i8 %li8 to i3236 zext i8 %li8 to i6437 38 %li16 = load i16, ptr undef39 zext i16 %li16 to i3240 zext i16 %li16 to i6441 42 %li32 = load i32, ptr undef43 zext i32 %li32 to i6444 45 ret void46 47; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li8 = load i8, ptr undef48; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %1 = zext i8 %li8 to i1649; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %2 = zext i8 %li8 to i3250; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %3 = zext i8 %li8 to i6451; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li16 = load i16, ptr undef52; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %4 = zext i16 %li16 to i3253; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %5 = zext i16 %li16 to i6454; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li32 = load i32, ptr undef55; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %6 = zext i32 %li32 to i6456}57