blob: b021fe0429a55312770cae811ff87d734155940a [file] [log] [blame]
Benjamin Kramer4145c0d2011-04-28 16:58:40 +00001; RUN: opt -S -instcombine < %s | FileCheck %s
2
3define i1 @test1(i16* %x) {
4 %load = load i16* %x, align 4
5 %trunc = trunc i16 %load to i8
6 %cmp1 = icmp eq i8 %trunc, 127
7 %and = and i16 %load, -256
8 %cmp2 = icmp eq i16 %and, 17664
9 %or = and i1 %cmp1, %cmp2
10 ret i1 %or
Stephen Linc1c7a132013-07-14 01:42:54 +000011; CHECK-LABEL: @test1(
Benjamin Kramer4145c0d2011-04-28 16:58:40 +000012; CHECK-NEXT: load i16
13; CHECK-NEXT: icmp eq i16 %load, 17791
14; CHECK-NEXT: ret i1
15}
16
17define i1 @test2(i16* %x) {
18 %load = load i16* %x, align 4
19 %and = and i16 %load, -256
20 %cmp1 = icmp eq i16 %and, 32512
21 %trunc = trunc i16 %load to i8
22 %cmp2 = icmp eq i8 %trunc, 69
23 %or = and i1 %cmp1, %cmp2
24 ret i1 %or
Stephen Linc1c7a132013-07-14 01:42:54 +000025; CHECK-LABEL: @test2(
Benjamin Kramer4145c0d2011-04-28 16:58:40 +000026; CHECK-NEXT: load i16
27; CHECK-NEXT: icmp eq i16 %load, 32581
28; CHECK-NEXT: ret i1
29}