1; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
2;
3; Test costs for i8 and i16 comparisons against memory with a small immediate.
4
5define i32 @fun0(i8* %Src, i8* %Dst, i8 %Val) {
6; CHECK: Printing analysis 'Cost Model Analysis' for function 'fun0':
7; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %Ld = load i8, i8* %Src
8; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %Cmp = icmp eq i8 %Ld, 123
9; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %Ret = zext i1 %Cmp to i32
10; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   ret i32 %Ret
11  %Ld = load i8, i8* %Src
12  %Cmp = icmp eq i8 %Ld, 123
13  %Ret = zext i1 %Cmp to i32
14  ret i32 %Ret
15}
16
17define i32 @fun1(i16* %Src, i16* %Dst, i16 %Val) {
18; CHECK: Printing analysis 'Cost Model Analysis' for function 'fun1':
19; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %Ld = load i16, i16* %Src
20; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %Cmp = icmp eq i16
21; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %Ret = zext i1 %Cmp to i32
22; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   ret i32 %Ret
23  %Ld = load i16, i16* %Src
24  %Cmp = icmp eq i16 %Ld, 1234
25  %Ret = zext i1 %Cmp to i32
26  ret i32 %Ret
27}
28