14178e334SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s 2011a503fSJonas Paulsson; 3011a503fSJonas Paulsson; Test costs for i8 and i16 comparisons against memory with a small immediate. 4011a503fSJonas Paulsson 5*68c50b11SNikita Popovdefine i32 @fun0(ptr %Src, ptr %Dst, i8 %Val) { 615ba588dSArthur Eubanks; CHECK: function 'fun0' 7*68c50b11SNikita Popov; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %Ld = load i8, ptr %Src 8011a503fSJonas Paulsson; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %Cmp = icmp eq i8 %Ld, 123 9011a503fSJonas Paulsson; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %Ret = zext i1 %Cmp to i32 102596da31SSam Parker; CHECK: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %Ret 11*68c50b11SNikita Popov %Ld = load i8, ptr %Src 12011a503fSJonas Paulsson %Cmp = icmp eq i8 %Ld, 123 13011a503fSJonas Paulsson %Ret = zext i1 %Cmp to i32 14011a503fSJonas Paulsson ret i32 %Ret 15011a503fSJonas Paulsson} 16011a503fSJonas Paulsson 17*68c50b11SNikita Popovdefine i32 @fun1(ptr %Src, ptr %Dst, i16 %Val) { 1815ba588dSArthur Eubanks; CHECK: function 'fun1' 19*68c50b11SNikita Popov; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %Ld = load i16, ptr %Src 20011a503fSJonas Paulsson; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %Cmp = icmp eq i16 21011a503fSJonas Paulsson; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %Ret = zext i1 %Cmp to i32 222596da31SSam Parker; CHECK: Cost Model: Found an estimated cost of 1 for instruction: ret i32 %Ret 23*68c50b11SNikita Popov %Ld = load i16, ptr %Src 24011a503fSJonas Paulsson %Cmp = icmp eq i16 %Ld, 1234 25011a503fSJonas Paulsson %Ret = zext i1 %Cmp to i32 26011a503fSJonas Paulsson ret i32 %Ret 27011a503fSJonas Paulsson} 28