• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -cost-model -cost-kind=code-size -analyze \
2; RUN:   -mtriple=s390x-unknown-linux -mcpu=z13  | FileCheck %s
3;
4; Check that getUserCost() does not return TCC_Free for extensions of
5; 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, 0
10; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %z = zext i1 %cmp to i64
11; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   ret i64 %z
12  %cmp = icmp eq i64 %v, 0
13  %z = zext i1 %cmp to i64
14  ret i64 %z
15}
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, 0
20; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %z = sext i1 %cmp to i64
21; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   ret i64 %z
22  %cmp = icmp eq i64 %v, 0
23  %z = sext i1 %cmp to i64
24  ret i64 %z
25}
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, 0
30; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %z = uitofp i1 %cmp to double
31; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   ret double %z
32  %cmp = icmp eq i64 %v, 0
33  %z = uitofp i1 %cmp to double
34  ret double %z
35}
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, 0
40; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %z = sitofp i1 %cmp to double
41; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   ret double %z
42  %cmp = icmp eq i64 %v, 0
43  %z = sitofp i1 %cmp to double
44  ret double %z
45}
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 i64
50; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   ret i64 %z
51  %z = zext i1 %v to i64
52  ret i64 %z
53}
54