blob: 3bd8c287af963fcf5b49df15042538ca035f8765 [file] [log] [blame]
Matthias Braunc31032d2016-03-09 18:47:11 +00001; RUN: opt -S -instsimplify -instcombine < %s | FileCheck %s
Sanjoy Das1d1929a2015-10-28 03:20:15 +00002
3define i1 @test0(i8* %ptr) {
4; CHECK-LABEL: @test0(
5 entry:
6 %val = load i8, i8* %ptr, !range !{i8 -50, i8 0}
7 %and = and i8 %val, 128
8 %is.eq = icmp eq i8 %and, 128
9 ret i1 %is.eq
10; CHECK: ret i1 true
11}
12
13define i1 @test1(i8* %ptr) {
14; CHECK-LABEL: @test1(
15 entry:
16 %val = load i8, i8* %ptr, !range !{i8 64, i8 128}
17 %and = and i8 %val, 64
18 %is.eq = icmp eq i8 %and, 64
19 ret i1 %is.eq
20; CHECK: ret i1 true
21}
22
23define i1 @test2(i8* %ptr) {
24; CHECK-LABEL: @test2(
25 entry:
Matthias Braunc31032d2016-03-09 18:47:11 +000026; CHECK: %val = load i8
27; CHECK: %and = and i8 %val
28; CHECK: %is.eq = icmp ne i8 %and, 0
29; CHECK: ret i1 %is.eq
Sanjoy Das1d1929a2015-10-28 03:20:15 +000030 %val = load i8, i8* %ptr, !range !{i8 64, i8 129}
31 %and = and i8 %val, 64
32 %is.eq = icmp eq i8 %and, 64
33 ret i1 %is.eq
34}