• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -instsimplify -instcombine < %s | FileCheck %s
2
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:
26; 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
30  %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}
35