1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
5 define void @f(ptr %x) nounwind {
8 ; CHECK-NEXT: br label [[BB:%.*]]
10 ; CHECK-NEXT: [[L1:%.*]] = load i8, ptr [[X:%.*]], align 1
11 ; CHECK-NEXT: [[TMP0:%.*]] = add i8 [[L1]], -9
12 ; CHECK-NEXT: [[C1:%.*]] = icmp ult i8 [[TMP0]], -3
13 ; CHECK-NEXT: [[TMP1:%.*]] = add i8 [[L1]], -13
14 ; CHECK-NEXT: [[C2:%.*]] = icmp ult i8 [[TMP1]], -3
15 ; CHECK-NEXT: [[A1:%.*]] = and i1 [[C1]], [[C2]]
16 ; CHECK-NEXT: br i1 [[A1]], label [[INCOMPATIBLE:%.*]], label [[OKAY:%.*]]
18 ; CHECK-NEXT: ret void
19 ; CHECK: incompatible:
20 ; CHECK-NEXT: ret void
26 %l1 = load i8, ptr %x, align 1
28 %c1 = icmp ugt i8 %s1, 2
30 %c2 = icmp ugt i8 %s2, 2
32 br i1 %a1, label %incompatible, label %okay
41 define void @f_logical(ptr %x) nounwind {
42 ; CHECK-LABEL: @f_logical(
44 ; CHECK-NEXT: br label [[BB:%.*]]
46 ; CHECK-NEXT: [[L1:%.*]] = load i8, ptr [[X:%.*]], align 1
47 ; CHECK-NEXT: [[TMP0:%.*]] = add i8 [[L1]], -9
48 ; CHECK-NEXT: [[C1:%.*]] = icmp ult i8 [[TMP0]], -3
49 ; CHECK-NEXT: [[TMP1:%.*]] = add i8 [[L1]], -13
50 ; CHECK-NEXT: [[C2:%.*]] = icmp ult i8 [[TMP1]], -3
51 ; CHECK-NEXT: [[A1:%.*]] = and i1 [[C1]], [[C2]]
52 ; CHECK-NEXT: br i1 [[A1]], label [[INCOMPATIBLE:%.*]], label [[OKAY:%.*]]
54 ; CHECK-NEXT: ret void
55 ; CHECK: incompatible:
56 ; CHECK-NEXT: ret void
62 %l1 = load i8, ptr %x, align 1
64 %c1 = icmp ugt i8 %s1, 2
66 %c2 = icmp ugt i8 %s2, 2
67 %a1 = select i1 %c1, i1 %c2, i1 false
68 br i1 %a1, label %incompatible, label %okay