174447cf4SNoah Goldstein; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 274447cf4SNoah Goldstein; RUN: opt < %s -passes=instcombine -S | FileCheck %s 374447cf4SNoah Goldstein 474447cf4SNoah Goldsteindefine i1 @or_implies_sle(i8 %x, i8 %y, i1 %other) { 574447cf4SNoah Goldstein; CHECK-LABEL: @or_implies_sle( 674447cf4SNoah Goldstein; CHECK-NEXT: [[OR:%.*]] = or i8 [[X:%.*]], 23 774447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp sgt i8 [[OR]], [[Y:%.*]] 874447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 974447cf4SNoah Goldstein; CHECK: T: 10678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 1174447cf4SNoah Goldstein; CHECK: F: 1274447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 1374447cf4SNoah Goldstein; 1474447cf4SNoah Goldstein %or = or i8 %x, 23 1574447cf4SNoah Goldstein %cond = icmp sle i8 %or, %y 1674447cf4SNoah Goldstein br i1 %cond, label %T, label %F 1774447cf4SNoah GoldsteinT: 1874447cf4SNoah Goldstein %r = icmp sle i8 %x, %y 1974447cf4SNoah Goldstein ret i1 %r 2074447cf4SNoah GoldsteinF: 2174447cf4SNoah Goldstein ret i1 %other 2274447cf4SNoah Goldstein} 2374447cf4SNoah Goldstein 2474447cf4SNoah Goldsteindefine i1 @or_implies_sle_fail(i8 %x, i8 %y, i1 %other) { 2574447cf4SNoah Goldstein; CHECK-LABEL: @or_implies_sle_fail( 2674447cf4SNoah Goldstein; CHECK-NEXT: [[OR:%.*]] = or i8 [[X:%.*]], -34 2774447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp sgt i8 [[OR]], [[Y:%.*]] 2874447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 2974447cf4SNoah Goldstein; CHECK: T: 3074447cf4SNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp sle i8 [[X]], [[Y]] 3174447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 3274447cf4SNoah Goldstein; CHECK: F: 3374447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 3474447cf4SNoah Goldstein; 3574447cf4SNoah Goldstein %or = or i8 %x, -34 3674447cf4SNoah Goldstein %cond = icmp sle i8 %or, %y 3774447cf4SNoah Goldstein br i1 %cond, label %T, label %F 3874447cf4SNoah GoldsteinT: 3974447cf4SNoah Goldstein %r = icmp sle i8 %x, %y 4074447cf4SNoah Goldstein ret i1 %r 4174447cf4SNoah GoldsteinF: 4274447cf4SNoah Goldstein ret i1 %other 4374447cf4SNoah Goldstein} 4474447cf4SNoah Goldstein 4574447cf4SNoah Goldsteindefine i1 @or_distjoint_implies_ule(i8 %x, i8 %y, i1 %other) { 4674447cf4SNoah Goldstein; CHECK-LABEL: @or_distjoint_implies_ule( 4774447cf4SNoah Goldstein; CHECK-NEXT: [[X2:%.*]] = or disjoint i8 [[X:%.*]], 24 4874447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp ugt i8 [[X2]], [[Y:%.*]] 4974447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 5074447cf4SNoah Goldstein; CHECK: T: 51678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 5274447cf4SNoah Goldstein; CHECK: F: 5374447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 5474447cf4SNoah Goldstein; 5574447cf4SNoah Goldstein %x1 = or disjoint i8 %x, 23 5674447cf4SNoah Goldstein %x2 = or disjoint i8 %x, 24 5774447cf4SNoah Goldstein 5874447cf4SNoah Goldstein %cond = icmp ule i8 %x2, %y 5974447cf4SNoah Goldstein br i1 %cond, label %T, label %F 6074447cf4SNoah GoldsteinT: 6174447cf4SNoah Goldstein %r = icmp ule i8 %x1, %y 6274447cf4SNoah Goldstein ret i1 %r 6374447cf4SNoah GoldsteinF: 6474447cf4SNoah Goldstein ret i1 %other 6574447cf4SNoah Goldstein} 6674447cf4SNoah Goldstein 6774447cf4SNoah Goldsteindefine i1 @or_distjoint_implies_ule_fail(i8 %x, i8 %y, i1 %other) { 6874447cf4SNoah Goldstein; CHECK-LABEL: @or_distjoint_implies_ule_fail( 6974447cf4SNoah Goldstein; CHECK-NEXT: [[X2:%.*]] = or disjoint i8 [[X:%.*]], 24 7074447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp ugt i8 [[X2]], [[Y:%.*]] 7174447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 7274447cf4SNoah Goldstein; CHECK: T: 7374447cf4SNoah Goldstein; CHECK-NEXT: [[X1:%.*]] = or disjoint i8 [[X]], 28 7474447cf4SNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp ule i8 [[X1]], [[Y]] 7574447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 7674447cf4SNoah Goldstein; CHECK: F: 7774447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 7874447cf4SNoah Goldstein; 7974447cf4SNoah Goldstein %x1 = or disjoint i8 %x, 28 8074447cf4SNoah Goldstein %x2 = or disjoint i8 %x, 24 8174447cf4SNoah Goldstein 8274447cf4SNoah Goldstein %cond = icmp ule i8 %x2, %y 8374447cf4SNoah Goldstein br i1 %cond, label %T, label %F 8474447cf4SNoah GoldsteinT: 8574447cf4SNoah Goldstein %r = icmp ule i8 %x1, %y 8674447cf4SNoah Goldstein ret i1 %r 8774447cf4SNoah GoldsteinF: 8874447cf4SNoah Goldstein ret i1 %other 8974447cf4SNoah Goldstein} 9074447cf4SNoah Goldstein 9174447cf4SNoah Goldsteindefine i1 @or_prove_distjoin_implies_ule(i8 %xx, i8 %y, i1 %other) { 9274447cf4SNoah Goldstein; CHECK-LABEL: @or_prove_distjoin_implies_ule( 9374447cf4SNoah Goldstein; CHECK-NEXT: [[X:%.*]] = and i8 [[XX:%.*]], -16 9474447cf4SNoah Goldstein; CHECK-NEXT: [[X2:%.*]] = or disjoint i8 [[X]], 10 9574447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp ugt i8 [[X2]], [[Y:%.*]] 9674447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 9774447cf4SNoah Goldstein; CHECK: T: 9874447cf4SNoah Goldstein; CHECK-NEXT: ret i1 true 9974447cf4SNoah Goldstein; CHECK: F: 10074447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 10174447cf4SNoah Goldstein; 10274447cf4SNoah Goldstein %x = and i8 %xx, -16 10374447cf4SNoah Goldstein %x1 = or i8 %x, 7 10474447cf4SNoah Goldstein %x2 = or i8 %x, 10 10574447cf4SNoah Goldstein 10674447cf4SNoah Goldstein %cond = icmp ule i8 %x2, %y 10774447cf4SNoah Goldstein br i1 %cond, label %T, label %F 10874447cf4SNoah GoldsteinT: 10974447cf4SNoah Goldstein %r = icmp ule i8 %x1, %y 11074447cf4SNoah Goldstein ret i1 %r 11174447cf4SNoah GoldsteinF: 11274447cf4SNoah Goldstein ret i1 %other 11374447cf4SNoah Goldstein} 11474447cf4SNoah Goldstein 11574447cf4SNoah Goldsteindefine i1 @src_or_distjoint_implies_sle(i8 %x, i8 %y, i1 %other) { 11674447cf4SNoah Goldstein; CHECK-LABEL: @src_or_distjoint_implies_sle( 11774447cf4SNoah Goldstein; CHECK-NEXT: [[X2:%.*]] = or disjoint i8 [[X:%.*]], 24 11874447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp sgt i8 [[X2]], [[Y:%.*]] 11974447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 12074447cf4SNoah Goldstein; CHECK: T: 121678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 12274447cf4SNoah Goldstein; CHECK: F: 12374447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 12474447cf4SNoah Goldstein; 12574447cf4SNoah Goldstein %x1 = or disjoint i8 %x, 23 12674447cf4SNoah Goldstein %x2 = or disjoint i8 %x, 24 12774447cf4SNoah Goldstein 12874447cf4SNoah Goldstein %cond = icmp sle i8 %x2, %y 12974447cf4SNoah Goldstein br i1 %cond, label %T, label %F 13074447cf4SNoah GoldsteinT: 13174447cf4SNoah Goldstein %r = icmp sle i8 %x1, %y 13274447cf4SNoah Goldstein ret i1 %r 13374447cf4SNoah GoldsteinF: 13474447cf4SNoah Goldstein ret i1 %other 13574447cf4SNoah Goldstein} 13674447cf4SNoah Goldstein 13774447cf4SNoah Goldsteindefine i1 @src_or_distjoint_implies_sle_fail(i8 %x, i8 %y, i1 %other) { 13874447cf4SNoah Goldstein; CHECK-LABEL: @src_or_distjoint_implies_sle_fail( 13974447cf4SNoah Goldstein; CHECK-NEXT: [[X2:%.*]] = or disjoint i8 [[X:%.*]], 24 140*a1058776SNikita Popov; CHECK-NEXT: [[COND_NOT:%.*]] = icmp sgt i8 [[Y:%.*]], [[X2]] 14174447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 14274447cf4SNoah Goldstein; CHECK: T: 14374447cf4SNoah Goldstein; CHECK-NEXT: [[X1:%.*]] = or disjoint i8 [[X]], 23 14474447cf4SNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp sle i8 [[X1]], [[Y]] 14574447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 14674447cf4SNoah Goldstein; CHECK: F: 14774447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 14874447cf4SNoah Goldstein; 14974447cf4SNoah Goldstein %x1 = or disjoint i8 %x, 23 15074447cf4SNoah Goldstein %x2 = or disjoint i8 %x, 24 15174447cf4SNoah Goldstein 15274447cf4SNoah Goldstein %cond = icmp sle i8 %y, %x2 15374447cf4SNoah Goldstein br i1 %cond, label %T, label %F 15474447cf4SNoah GoldsteinT: 15574447cf4SNoah Goldstein %r = icmp sle i8 %x1, %y 15674447cf4SNoah Goldstein ret i1 %r 15774447cf4SNoah GoldsteinF: 15874447cf4SNoah Goldstein ret i1 %other 15974447cf4SNoah Goldstein} 16074447cf4SNoah Goldstein 16174447cf4SNoah Goldsteindefine i1 @src_addnsw_implies_sle(i8 %x, i8 %y, i1 %other) { 16274447cf4SNoah Goldstein; CHECK-LABEL: @src_addnsw_implies_sle( 16374447cf4SNoah Goldstein; CHECK-NEXT: [[X2:%.*]] = add nsw i8 [[X:%.*]], 24 16474447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp sgt i8 [[X2]], [[Y:%.*]] 16574447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 16674447cf4SNoah Goldstein; CHECK: T: 167678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 16874447cf4SNoah Goldstein; CHECK: F: 16974447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 17074447cf4SNoah Goldstein; 17174447cf4SNoah Goldstein %x1 = add nsw i8 %x, 23 17274447cf4SNoah Goldstein %x2 = add nsw i8 %x, 24 17374447cf4SNoah Goldstein 17474447cf4SNoah Goldstein %cond = icmp sle i8 %x2, %y 17574447cf4SNoah Goldstein br i1 %cond, label %T, label %F 17674447cf4SNoah GoldsteinT: 17774447cf4SNoah Goldstein %r = icmp sle i8 %x1, %y 17874447cf4SNoah Goldstein ret i1 %r 17974447cf4SNoah GoldsteinF: 18074447cf4SNoah Goldstein ret i1 %other 18174447cf4SNoah Goldstein} 18274447cf4SNoah Goldstein 18374447cf4SNoah Goldsteindefine i1 @src_addnsw_implies_sle_fail(i8 %x, i8 %y, i1 %other) { 18474447cf4SNoah Goldstein; CHECK-LABEL: @src_addnsw_implies_sle_fail( 18574447cf4SNoah Goldstein; CHECK-NEXT: [[X2:%.*]] = add nsw i8 [[X:%.*]], 23 18674447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp sgt i8 [[X2]], [[Y:%.*]] 18774447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 18874447cf4SNoah Goldstein; CHECK: T: 18974447cf4SNoah Goldstein; CHECK-NEXT: [[X1:%.*]] = add nsw i8 [[X]], 24 19074447cf4SNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp sle i8 [[X1]], [[Y]] 19174447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 19274447cf4SNoah Goldstein; CHECK: F: 19374447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 19474447cf4SNoah Goldstein; 19574447cf4SNoah Goldstein %x1 = add nsw i8 %x, 24 19674447cf4SNoah Goldstein %x2 = add nsw i8 %x, 23 19774447cf4SNoah Goldstein 19874447cf4SNoah Goldstein %cond = icmp sle i8 %x2, %y 19974447cf4SNoah Goldstein br i1 %cond, label %T, label %F 20074447cf4SNoah GoldsteinT: 20174447cf4SNoah Goldstein %r = icmp sle i8 %x1, %y 20274447cf4SNoah Goldstein ret i1 %r 20374447cf4SNoah GoldsteinF: 20474447cf4SNoah Goldstein ret i1 %other 20574447cf4SNoah Goldstein} 20674447cf4SNoah Goldstein 20774447cf4SNoah Goldsteindefine i1 @src_and_implies_ult(i8 %x, i8 %y, i8 %z, i1 %other) { 20874447cf4SNoah Goldstein; CHECK-LABEL: @src_and_implies_ult( 20974447cf4SNoah Goldstein; CHECK-NEXT: [[COND:%.*]] = icmp ult i8 [[X:%.*]], [[Z:%.*]] 21074447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND]], label [[T:%.*]], label [[F:%.*]] 21174447cf4SNoah Goldstein; CHECK: T: 212678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 21374447cf4SNoah Goldstein; CHECK: F: 21474447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 21574447cf4SNoah Goldstein; 21674447cf4SNoah Goldstein %cond = icmp ult i8 %x, %z 21774447cf4SNoah Goldstein br i1 %cond, label %T, label %F 21874447cf4SNoah GoldsteinT: 21974447cf4SNoah Goldstein %and = and i8 %z, %x 22074447cf4SNoah Goldstein %r = icmp ult i8 %and, %z 22174447cf4SNoah Goldstein ret i1 %r 22274447cf4SNoah GoldsteinF: 22374447cf4SNoah Goldstein ret i1 %other 22474447cf4SNoah Goldstein} 22574447cf4SNoah Goldstein 22674447cf4SNoah Goldsteindefine i1 @src_and_implies_ult_fail(i8 %x, i8 %y, i8 %z, i1 %other) { 22774447cf4SNoah Goldstein; CHECK-LABEL: @src_and_implies_ult_fail( 22874447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp ugt i8 [[X:%.*]], [[Z:%.*]] 22974447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 23074447cf4SNoah Goldstein; CHECK: T: 23174447cf4SNoah Goldstein; CHECK-NEXT: [[AND:%.*]] = and i8 [[X]], [[Z]] 23274447cf4SNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp ne i8 [[AND]], [[Z]] 23374447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 23474447cf4SNoah Goldstein; CHECK: F: 23574447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 23674447cf4SNoah Goldstein; 23774447cf4SNoah Goldstein %cond = icmp ule i8 %x, %z 23874447cf4SNoah Goldstein br i1 %cond, label %T, label %F 23974447cf4SNoah GoldsteinT: 24074447cf4SNoah Goldstein %and = and i8 %x, %z 24174447cf4SNoah Goldstein %r = icmp ult i8 %and, %z 24274447cf4SNoah Goldstein ret i1 %r 24374447cf4SNoah GoldsteinF: 24474447cf4SNoah Goldstein ret i1 %other 24574447cf4SNoah Goldstein} 24674447cf4SNoah Goldstein 24774447cf4SNoah Goldsteindefine i1 @src_and_implies_slt_fail(i8 %x, i8 %y, i8 %z, i1 %other) { 24874447cf4SNoah Goldstein; CHECK-LABEL: @src_and_implies_slt_fail( 24974447cf4SNoah Goldstein; CHECK-NEXT: [[COND:%.*]] = icmp slt i8 [[X:%.*]], [[Z:%.*]] 25074447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND]], label [[T:%.*]], label [[F:%.*]] 25174447cf4SNoah Goldstein; CHECK: T: 25274447cf4SNoah Goldstein; CHECK-NEXT: [[AND:%.*]] = and i8 [[X]], [[Y:%.*]] 25374447cf4SNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp slt i8 [[AND]], [[Z]] 25474447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 25574447cf4SNoah Goldstein; CHECK: F: 25674447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 25774447cf4SNoah Goldstein; 25874447cf4SNoah Goldstein %cond = icmp slt i8 %x, %z 25974447cf4SNoah Goldstein br i1 %cond, label %T, label %F 26074447cf4SNoah GoldsteinT: 26174447cf4SNoah Goldstein %and = and i8 %x, %y 26274447cf4SNoah Goldstein %r = icmp slt i8 %and, %z 26374447cf4SNoah Goldstein ret i1 %r 26474447cf4SNoah GoldsteinF: 26574447cf4SNoah Goldstein ret i1 %other 26674447cf4SNoah Goldstein} 26774447cf4SNoah Goldstein 26874447cf4SNoah Goldsteindefine i1 @src_or_implies_ule(i8 %x, i8 %y, i8 %z, i1 %other) { 26974447cf4SNoah Goldstein; CHECK-LABEL: @src_or_implies_ule( 27074447cf4SNoah Goldstein; CHECK-NEXT: [[OR:%.*]] = or i8 [[Y:%.*]], [[X:%.*]] 271*a1058776SNikita Popov; CHECK-NEXT: [[COND_NOT:%.*]] = icmp ult i8 [[Z:%.*]], [[OR]] 27274447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 27374447cf4SNoah Goldstein; CHECK: T: 274678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 27574447cf4SNoah Goldstein; CHECK: F: 27674447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 27774447cf4SNoah Goldstein; 27874447cf4SNoah Goldstein %or = or i8 %y, %x 27974447cf4SNoah Goldstein %cond = icmp uge i8 %z, %or 28074447cf4SNoah Goldstein br i1 %cond, label %T, label %F 28174447cf4SNoah GoldsteinT: 28274447cf4SNoah Goldstein %r = icmp ule i8 %x, %z 28374447cf4SNoah Goldstein ret i1 %r 28474447cf4SNoah GoldsteinF: 28574447cf4SNoah Goldstein ret i1 %other 28674447cf4SNoah Goldstein} 28774447cf4SNoah Goldstein 28874447cf4SNoah Goldsteindefine i1 @src_or_implies_false_ugt_todo(i8 %x, i8 %y, i8 %z, i1 %other) { 28974447cf4SNoah Goldstein; CHECK-LABEL: @src_or_implies_false_ugt_todo( 29074447cf4SNoah Goldstein; CHECK-NEXT: [[OR:%.*]] = or i8 [[X:%.*]], [[Y:%.*]] 29174447cf4SNoah Goldstein; CHECK-NEXT: [[COND:%.*]] = icmp ugt i8 [[OR]], [[Z:%.*]] 29274447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND]], label [[T:%.*]], label [[F:%.*]] 29374447cf4SNoah Goldstein; CHECK: T: 29474447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 29574447cf4SNoah Goldstein; CHECK: F: 29674447cf4SNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp ugt i8 [[X]], [[Z]] 29774447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 29874447cf4SNoah Goldstein; 29974447cf4SNoah Goldstein %or = or i8 %x, %y 30074447cf4SNoah Goldstein %cond = icmp ugt i8 %or, %z 30174447cf4SNoah Goldstein br i1 %cond, label %T, label %F 30274447cf4SNoah GoldsteinT: 30374447cf4SNoah Goldstein ret i1 %other 30474447cf4SNoah GoldsteinF: 30574447cf4SNoah Goldstein %r = icmp ugt i8 %x, %z 30674447cf4SNoah Goldstein ret i1 %r 30774447cf4SNoah Goldstein 30874447cf4SNoah Goldstein} 30974447cf4SNoah Goldstein 31074447cf4SNoah Goldsteindefine i1 @src_udiv_implies_ult(i8 %x, i8 %z, i1 %other) { 31174447cf4SNoah Goldstein; CHECK-LABEL: @src_udiv_implies_ult( 31274447cf4SNoah Goldstein; CHECK-NEXT: [[COND:%.*]] = icmp ugt i8 [[Z:%.*]], [[X:%.*]] 31374447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND]], label [[T:%.*]], label [[F:%.*]] 31474447cf4SNoah Goldstein; CHECK: T: 315678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 31674447cf4SNoah Goldstein; CHECK: F: 31774447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 31874447cf4SNoah Goldstein; 31974447cf4SNoah Goldstein %cond = icmp ugt i8 %z, %x 32074447cf4SNoah Goldstein br i1 %cond, label %T, label %F 32174447cf4SNoah GoldsteinT: 32274447cf4SNoah Goldstein %and = udiv i8 %x, 3 32374447cf4SNoah Goldstein %r = icmp ult i8 %and, %z 32474447cf4SNoah Goldstein ret i1 %r 32574447cf4SNoah GoldsteinF: 32674447cf4SNoah Goldstein ret i1 %other 32774447cf4SNoah Goldstein} 32874447cf4SNoah Goldstein 32974447cf4SNoah Goldsteindefine i1 @src_udiv_implies_ult2(i8 %x, i8 %z, i1 %other) { 33074447cf4SNoah Goldstein; CHECK-LABEL: @src_udiv_implies_ult2( 33174447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp ugt i8 [[Z:%.*]], [[X:%.*]] 33274447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 33374447cf4SNoah Goldstein; CHECK: T: 33474447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 33574447cf4SNoah Goldstein; CHECK: F: 336678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 33774447cf4SNoah Goldstein; 33874447cf4SNoah Goldstein %cond = icmp ule i8 %z, %x 33974447cf4SNoah Goldstein br i1 %cond, label %T, label %F 34074447cf4SNoah GoldsteinT: 34174447cf4SNoah Goldstein ret i1 %other 34274447cf4SNoah GoldsteinF: 34374447cf4SNoah Goldstein %and = udiv i8 %x, 3 34474447cf4SNoah Goldstein %r = icmp ult i8 %and, %z 34574447cf4SNoah Goldstein ret i1 %r 34674447cf4SNoah Goldstein} 34774447cf4SNoah Goldstein 34874447cf4SNoah Goldsteindefine i1 @src_smin_implies_sle(i8 %x, i8 %y, i8 %z, i1 %other) { 34974447cf4SNoah Goldstein; CHECK-LABEL: @src_smin_implies_sle( 35074447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp sgt i8 [[X:%.*]], [[Z:%.*]] 35174447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 35274447cf4SNoah Goldstein; CHECK: T: 35374447cf4SNoah Goldstein; CHECK-NEXT: ret i1 true 35474447cf4SNoah Goldstein; CHECK: F: 35574447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 35674447cf4SNoah Goldstein; 35774447cf4SNoah Goldstein %cond = icmp sle i8 %x, %z 35874447cf4SNoah Goldstein br i1 %cond, label %T, label %F 35974447cf4SNoah GoldsteinT: 36074447cf4SNoah Goldstein %um = call i8 @llvm.smin.i8(i8 %x, i8 %y) 36174447cf4SNoah Goldstein %r = icmp sle i8 %um, %z 36274447cf4SNoah Goldstein ret i1 %r 36374447cf4SNoah GoldsteinF: 36474447cf4SNoah Goldstein ret i1 %other 36574447cf4SNoah Goldstein} 36674447cf4SNoah Goldstein 36774447cf4SNoah Goldsteindefine i1 @src_umin_implies_ule(i8 %x, i8 %y, i8 %z, i1 %other) { 36874447cf4SNoah Goldstein; CHECK-LABEL: @src_umin_implies_ule( 36974447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp ugt i8 [[X:%.*]], [[Z:%.*]] 37074447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 37174447cf4SNoah Goldstein; CHECK: T: 37274447cf4SNoah Goldstein; CHECK-NEXT: ret i1 true 37374447cf4SNoah Goldstein; CHECK: F: 37474447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 37574447cf4SNoah Goldstein; 37674447cf4SNoah Goldstein %cond = icmp ule i8 %x, %z 37774447cf4SNoah Goldstein br i1 %cond, label %T, label %F 37874447cf4SNoah GoldsteinT: 37974447cf4SNoah Goldstein %um = call i8 @llvm.umin.i8(i8 %x, i8 %y) 38074447cf4SNoah Goldstein %r = icmp ule i8 %um, %z 38174447cf4SNoah Goldstein ret i1 %r 38274447cf4SNoah GoldsteinF: 38374447cf4SNoah Goldstein ret i1 %other 38474447cf4SNoah Goldstein} 38574447cf4SNoah Goldstein 38674447cf4SNoah Goldsteindefine i1 @src_umax_implies_ule(i8 %x, i8 %y, i8 %z, i1 %other) { 38774447cf4SNoah Goldstein; CHECK-LABEL: @src_umax_implies_ule( 38874447cf4SNoah Goldstein; CHECK-NEXT: [[UM:%.*]] = call i8 @llvm.umax.i8(i8 [[X:%.*]], i8 [[Y:%.*]]) 38974447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp ugt i8 [[UM]], [[Z:%.*]] 39074447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 39174447cf4SNoah Goldstein; CHECK: T: 392678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 39374447cf4SNoah Goldstein; CHECK: F: 39474447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 39574447cf4SNoah Goldstein; 39674447cf4SNoah Goldstein %um = call i8 @llvm.umax.i8(i8 %x, i8 %y) 39774447cf4SNoah Goldstein %cond = icmp ule i8 %um, %z 39874447cf4SNoah Goldstein br i1 %cond, label %T, label %F 39974447cf4SNoah GoldsteinT: 40074447cf4SNoah Goldstein %r = icmp ule i8 %x, %z 40174447cf4SNoah Goldstein ret i1 %r 40274447cf4SNoah GoldsteinF: 40374447cf4SNoah Goldstein ret i1 %other 40474447cf4SNoah Goldstein} 40574447cf4SNoah Goldstein 40674447cf4SNoah Goldsteindefine i1 @src_smax_implies_sle(i8 %x, i8 %y, i8 %z, i1 %other) { 40774447cf4SNoah Goldstein; CHECK-LABEL: @src_smax_implies_sle( 40874447cf4SNoah Goldstein; CHECK-NEXT: [[UM:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 [[Y:%.*]]) 40974447cf4SNoah Goldstein; CHECK-NEXT: [[COND_NOT:%.*]] = icmp sgt i8 [[UM]], [[Z:%.*]] 41074447cf4SNoah Goldstein; CHECK-NEXT: br i1 [[COND_NOT]], label [[F:%.*]], label [[T:%.*]] 41174447cf4SNoah Goldstein; CHECK: T: 412678f32abSNoah Goldstein; CHECK-NEXT: ret i1 true 41374447cf4SNoah Goldstein; CHECK: F: 41474447cf4SNoah Goldstein; CHECK-NEXT: ret i1 [[OTHER:%.*]] 41574447cf4SNoah Goldstein; 41674447cf4SNoah Goldstein %um = call i8 @llvm.smax.i8(i8 %x, i8 %y) 41774447cf4SNoah Goldstein %cond = icmp sle i8 %um, %z 41874447cf4SNoah Goldstein br i1 %cond, label %T, label %F 41974447cf4SNoah GoldsteinT: 42074447cf4SNoah Goldstein %r = icmp sle i8 %x, %z 42174447cf4SNoah Goldstein ret i1 %r 42274447cf4SNoah GoldsteinF: 42374447cf4SNoah Goldstein ret i1 %other 42474447cf4SNoah Goldstein} 425