1; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
2;
3; Test that load and test results in 0 cost for the compare.
4
5define i64 @fun0(i64* %Src, i64 %Arg) {
6  %Ld1 = load i64, i64* %Src
7  %Cmp = icmp eq i64 %Ld1, 0
8  %S   = select i1 %Cmp, i64 %Arg, i64 %Ld1
9  ret i64 %S
10; CHECK: Printing analysis 'Cost Model Analysis' for function 'fun0':
11; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %Ld1 = load i64, i64* %Src
12; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %Cmp = icmp eq i64 %Ld1, 0
13; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %S = select
14}
15
16define i32 @fun1(i32* %Src, i32 %Arg) {
17  %Ld1 = load i32, i32* %Src
18  %Cmp = icmp eq i32 %Ld1, 0
19  %S   = select i1 %Cmp, i32 %Arg, i32 %Ld1
20  ret i32 %S
21; CHECK: Printing analysis 'Cost Model Analysis' for function 'fun1':
22; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %Ld1 = load i32, i32* %Src
23; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %Cmp = icmp eq i32 %Ld1, 0
24; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %S = select
25}
26