xref: /llvm-project/llvm/test/Analysis/CostModel/SystemZ/load-and-test.ll (revision 68c50b111d74afb9489cf97770fa917d0a1c7f77)
1; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -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(ptr %Src, i64 %Arg) {
6  %Ld1 = load i64, ptr %Src
7  %Cmp = icmp eq i64 %Ld1, 0
8  %S   = select i1 %Cmp, i64 %Arg, i64 %Ld1
9  ret i64 %S
10; CHECK: function 'fun0'
11; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %Ld1 = load i64, ptr %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(ptr %Src, i32 %Arg) {
17  %Ld1 = load i32, ptr %Src
18  %Cmp = icmp eq i32 %Ld1, 0
19  %S   = select i1 %Cmp, i32 %Arg, i32 %Ld1
20  ret i32 %S
21; CHECK: function 'fun1'
22; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %Ld1 = load i32, ptr %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