54 lines · plain
1; RUN: opt < %s -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output \2; RUN: -mtriple=s390x-unknown-linux -mcpu=z13 | FileCheck %s3;4; Check that getInstructionCost() does not return TCC_Free for extensions of5; i1 returned from icmp.6 7define i64 @fun1(i64 %v) {8; CHECK-LABEL: 'fun1'9; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %cmp = icmp eq i64 %v, 010; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %z = zext i1 %cmp to i6411; CHECK: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %z12 %cmp = icmp eq i64 %v, 013 %z = zext i1 %cmp to i6414 ret i64 %z15}16 17define i64 @fun2(i64 %v) {18; CHECK-LABEL: 'fun2'19; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %cmp = icmp eq i64 %v, 020; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %z = sext i1 %cmp to i6421; CHECK: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %z22 %cmp = icmp eq i64 %v, 023 %z = sext i1 %cmp to i6424 ret i64 %z25}26 27define double @fun3(i64 %v) {28; CHECK-LABEL: 'fun3'29; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %cmp = icmp eq i64 %v, 030; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %z = uitofp i1 %cmp to double31; CHECK: Cost Model: Found an estimated cost of 1 for instruction: ret double %z32 %cmp = icmp eq i64 %v, 033 %z = uitofp i1 %cmp to double34 ret double %z35}36 37define double @fun4(i64 %v) {38; CHECK-LABEL: 'fun4'39; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %cmp = icmp eq i64 %v, 040; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %z = sitofp i1 %cmp to double41; CHECK: Cost Model: Found an estimated cost of 1 for instruction: ret double %z42 %cmp = icmp eq i64 %v, 043 %z = sitofp i1 %cmp to double44 ret double %z45}46 47define i64 @fun5(i1 %v) {48; CHECK-LABEL: 'fun5'49; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %z = zext i1 %v to i6450; CHECK: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %z51 %z = zext i1 %v to i6452 ret i64 %z53}54