1530bbc8fSNoah Goldstein; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2530bbc8fSNoah Goldstein; RUN: opt < %s -passes=instsimplify -S | FileCheck %s 3530bbc8fSNoah Goldstein 4530bbc8fSNoah Goldsteindeclare void @llvm.assume(i1) 5530bbc8fSNoah Goldsteindefine <2 x i1> @select_v_ne_z(<2 x i8> %v, <2 x i8> %yy) { 6530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_ne_z( 7*2622b2f4SNoah Goldstein; CHECK-NEXT: ret <2 x i1> zeroinitializer 8530bbc8fSNoah Goldstein; 9530bbc8fSNoah Goldstein %y = or <2 x i8> %yy, <i8 1, i8 1> 10530bbc8fSNoah Goldstein %cmp = icmp ne <2 x i8> %v, zeroinitializer 11530bbc8fSNoah Goldstein %s = select <2 x i1> %cmp, <2 x i8> %v, <2 x i8> %y 12530bbc8fSNoah Goldstein %r = icmp eq <2 x i8> %s, zeroinitializer 13530bbc8fSNoah Goldstein ret <2 x i1> %r 14530bbc8fSNoah Goldstein} 15530bbc8fSNoah Goldstein 16530bbc8fSNoah Goldsteindefine i1 @select_v_ne_fail(i8 %v, i8 %y) { 17530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_ne_fail( 18530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 19530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 20530bbc8fSNoah Goldstein; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[V:%.*]], 1 21530bbc8fSNoah Goldstein; CHECK-NEXT: [[S:%.*]] = select i1 [[CMP]], i8 [[V]], i8 [[Y]] 22530bbc8fSNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[S]], 0 23530bbc8fSNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 24530bbc8fSNoah Goldstein; 25530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 26530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 27530bbc8fSNoah Goldstein %cmp = icmp ne i8 %v, 1 28530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 29530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 30530bbc8fSNoah Goldstein ret i1 %r 31530bbc8fSNoah Goldstein} 32530bbc8fSNoah Goldstein 33530bbc8fSNoah Goldsteindefine i1 @select_v_eq_nz(i8 %v, i8 %y) { 34530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_eq_nz( 35530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 36530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 37*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 38530bbc8fSNoah Goldstein; 39530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 40530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 41530bbc8fSNoah Goldstein %cmp = icmp eq i8 44, %v 42530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 43530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 44530bbc8fSNoah Goldstein ret i1 %r 45530bbc8fSNoah Goldstein} 46530bbc8fSNoah Goldstein 47530bbc8fSNoah Goldsteindefine i1 @inv_select_v_ugt_nz(i8 %v, i8 %C, i8 %y) { 48530bbc8fSNoah Goldstein; CHECK-LABEL: @inv_select_v_ugt_nz( 49530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 50530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 51*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 52530bbc8fSNoah Goldstein; 53530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 54530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 55530bbc8fSNoah Goldstein %cmp = icmp ugt i8 14, %v 56530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %y, i8 %v 57530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 58530bbc8fSNoah Goldstein ret i1 %r 59530bbc8fSNoah Goldstein} 60530bbc8fSNoah Goldstein 61530bbc8fSNoah Goldsteindefine i1 @inv_select_v_ugt_fail(i8 %v, i8 %C, i8 %y) { 62530bbc8fSNoah Goldstein; CHECK-LABEL: @inv_select_v_ugt_fail( 63530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 64530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 65*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 66530bbc8fSNoah Goldstein; 67530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 68530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 69530bbc8fSNoah Goldstein %cmp = icmp ugt i8 -2, %v 70530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %y, i8 %v 71530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 72530bbc8fSNoah Goldstein ret i1 %r 73530bbc8fSNoah Goldstein} 74530bbc8fSNoah Goldstein 75530bbc8fSNoah Goldsteindefine <2 x i1> @select_v_ult(<2 x i8> %v, <2 x i8> %C, <2 x i8> %yy) { 76530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_ult( 77*2622b2f4SNoah Goldstein; CHECK-NEXT: ret <2 x i1> zeroinitializer 78530bbc8fSNoah Goldstein; 79530bbc8fSNoah Goldstein %y = or <2 x i8> %yy, <i8 1, i8 1> 80530bbc8fSNoah Goldstein %cmp = icmp ult <2 x i8> %C, %v 81530bbc8fSNoah Goldstein %s = select <2 x i1> %cmp, <2 x i8> %v, <2 x i8> %y 82530bbc8fSNoah Goldstein %r = icmp eq <2 x i8> %s, zeroinitializer 83530bbc8fSNoah Goldstein ret <2 x i1> %r 84530bbc8fSNoah Goldstein} 85530bbc8fSNoah Goldstein 86530bbc8fSNoah Goldsteindefine <2 x i1> @select_v_uge_nz(<2 x i8> %v, <2 x i8> %yy) { 87530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_uge_nz( 88*2622b2f4SNoah Goldstein; CHECK-NEXT: ret <2 x i1> zeroinitializer 89530bbc8fSNoah Goldstein; 90530bbc8fSNoah Goldstein %y = or <2 x i8> %yy, <i8 1, i8 1> 91530bbc8fSNoah Goldstein %cmp = icmp uge <2 x i8> %v, <i8 1, i8 1> 92530bbc8fSNoah Goldstein %s = select <2 x i1> %cmp, <2 x i8> %v, <2 x i8> %y 93530bbc8fSNoah Goldstein %r = icmp eq <2 x i8> %s, zeroinitializer 94530bbc8fSNoah Goldstein ret <2 x i1> %r 95530bbc8fSNoah Goldstein} 96530bbc8fSNoah Goldstein 97530bbc8fSNoah Goldsteindefine i1 @inv_select_v_ule(i8 %v, i8 %y) { 98530bbc8fSNoah Goldstein; CHECK-LABEL: @inv_select_v_ule( 99530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 100530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 101*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 102530bbc8fSNoah Goldstein; 103530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 104530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 105530bbc8fSNoah Goldstein %cmp = icmp ule i8 %v, 4 106530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %y, i8 %v 107530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 108530bbc8fSNoah Goldstein ret i1 %r 109530bbc8fSNoah Goldstein} 110530bbc8fSNoah Goldstein 111530bbc8fSNoah Goldsteindefine i1 @select_v_sgt_nonneg(i8 %v, i8 %y) { 112530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_sgt_nonneg( 113530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 114530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 115*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 116530bbc8fSNoah Goldstein; 117530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 118530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 119530bbc8fSNoah Goldstein %cmp = icmp sgt i8 %v, 0 120530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 121530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 122530bbc8fSNoah Goldstein ret i1 %r 123530bbc8fSNoah Goldstein} 124530bbc8fSNoah Goldstein 125530bbc8fSNoah Goldsteindefine i1 @select_v_sgt_fail(i8 %v, i8 %y) { 126530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_sgt_fail( 127530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 128530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 129530bbc8fSNoah Goldstein; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[V:%.*]], -1 130530bbc8fSNoah Goldstein; CHECK-NEXT: [[S:%.*]] = select i1 [[CMP]], i8 [[V]], i8 [[Y]] 131530bbc8fSNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[S]], 0 132530bbc8fSNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 133530bbc8fSNoah Goldstein; 134530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 135530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 136530bbc8fSNoah Goldstein %cmp = icmp sgt i8 %v, -1 137530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 138530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 139530bbc8fSNoah Goldstein ret i1 %r 140530bbc8fSNoah Goldstein} 141530bbc8fSNoah Goldstein 142530bbc8fSNoah Goldsteindefine i1 @inv_select_v_sgt_neg(i8 %v, i8 %y) { 143530bbc8fSNoah Goldstein; CHECK-LABEL: @inv_select_v_sgt_neg( 144530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 145530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 146*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 147530bbc8fSNoah Goldstein; 148530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 149530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 150530bbc8fSNoah Goldstein %cmp = icmp sgt i8 %v, -1 151530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %y, i8 %v 152530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 153530bbc8fSNoah Goldstein ret i1 %r 154530bbc8fSNoah Goldstein} 155530bbc8fSNoah Goldstein 156530bbc8fSNoah Goldsteindefine i1 @inv_select_v_sgt_nonneg_nz(i8 %v, i8 %C, i8 %y) { 157530bbc8fSNoah Goldstein; CHECK-LABEL: @inv_select_v_sgt_nonneg_nz( 158530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 159530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 160*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 161530bbc8fSNoah Goldstein; 162530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 163530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 164530bbc8fSNoah Goldstein %cmp = icmp sgt i8 99, %v 165530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %y, i8 %v 166530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 167530bbc8fSNoah Goldstein ret i1 %r 168530bbc8fSNoah Goldstein} 169530bbc8fSNoah Goldstein 170530bbc8fSNoah Goldsteindefine i1 @select_v_slt_nonneg(i8 %v, i8 %y) { 171530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_slt_nonneg( 172530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 173530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 174*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 175530bbc8fSNoah Goldstein; 176530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 177530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 178530bbc8fSNoah Goldstein %cmp = icmp slt i8 0, %v 179530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 180530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 181530bbc8fSNoah Goldstein ret i1 %r 182530bbc8fSNoah Goldstein} 183530bbc8fSNoah Goldstein 184530bbc8fSNoah Goldsteindefine i1 @select_v_slt_nonneg_fail(i8 %v, i8 %C, i8 %y) { 185530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_slt_nonneg_fail( 186530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 187530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 188530bbc8fSNoah Goldstein; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 -1, [[V:%.*]] 189530bbc8fSNoah Goldstein; CHECK-NEXT: [[S:%.*]] = select i1 [[CMP]], i8 [[V]], i8 [[Y]] 190530bbc8fSNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[S]], 0 191530bbc8fSNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 192530bbc8fSNoah Goldstein; 193530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 194530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 195530bbc8fSNoah Goldstein %cmp = icmp slt i8 -1, %v 196530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 197530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 198530bbc8fSNoah Goldstein ret i1 %r 199530bbc8fSNoah Goldstein} 200530bbc8fSNoah Goldstein 201530bbc8fSNoah Goldsteindefine i1 @select_v_slt_neg(i8 %v, i8 %y) { 202530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_slt_neg( 203530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 204530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 205*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 206530bbc8fSNoah Goldstein; 207530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 208530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 209530bbc8fSNoah Goldstein %cmp = icmp slt i8 %v, -1 210530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 211530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 212530bbc8fSNoah Goldstein ret i1 %r 213530bbc8fSNoah Goldstein} 214530bbc8fSNoah Goldstein 215530bbc8fSNoah Goldsteindefine i1 @select_v_sge_nonneg_nz(i8 %v, i8 %y) { 216530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_sge_nonneg_nz( 217530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 218530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 219*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 220530bbc8fSNoah Goldstein; 221530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 222530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 223530bbc8fSNoah Goldstein %cmp = icmp sge i8 %v, 1 224530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 225530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 226530bbc8fSNoah Goldstein ret i1 %r 227530bbc8fSNoah Goldstein} 228530bbc8fSNoah Goldstein 229530bbc8fSNoah Goldsteindefine i1 @select_v_sge_neg(i8 %v, i8 %y) { 230530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_sge_neg( 231530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 232530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 233*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 234530bbc8fSNoah Goldstein; 235530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 236530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 237530bbc8fSNoah Goldstein %cmp = icmp sge i8 -3, %v 238530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 239530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 240530bbc8fSNoah Goldstein ret i1 %r 241530bbc8fSNoah Goldstein} 242530bbc8fSNoah Goldstein 243530bbc8fSNoah Goldsteindefine i1 @inv_select_v_sge_z(i8 %v, i8 %y) { 244530bbc8fSNoah Goldstein; CHECK-LABEL: @inv_select_v_sge_z( 245530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 246530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 247*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 248530bbc8fSNoah Goldstein; 249530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 250530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 251530bbc8fSNoah Goldstein %cmp = icmp sge i8 %v, 0 252530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %y, i8 %v 253530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 254530bbc8fSNoah Goldstein ret i1 %r 255530bbc8fSNoah Goldstein} 256530bbc8fSNoah Goldstein 257530bbc8fSNoah Goldsteindefine i1 @inv_select_v_sge_fail(i8 %v, i8 %C, i8 %y) { 258530bbc8fSNoah Goldstein; CHECK-LABEL: @inv_select_v_sge_fail( 259530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 260530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 261*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 262530bbc8fSNoah Goldstein; 263530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 264530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 265530bbc8fSNoah Goldstein %cmp = icmp sge i8 %v, -44 266530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %y, i8 %v 267530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 268530bbc8fSNoah Goldstein ret i1 %r 269530bbc8fSNoah Goldstein} 270530bbc8fSNoah Goldstein 271530bbc8fSNoah Goldsteindefine i1 @select_v_sle_neg(i8 %v, i8 %y) { 272530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_sle_neg( 273530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 274530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 275*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 276530bbc8fSNoah Goldstein; 277530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 278530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 279530bbc8fSNoah Goldstein %cmp = icmp sle i8 %v, -1 280530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 281530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 282530bbc8fSNoah Goldstein ret i1 %r 283530bbc8fSNoah Goldstein} 284530bbc8fSNoah Goldstein 285530bbc8fSNoah Goldsteindefine i1 @select_v_sle_nonneg_nz(i8 %v, i8 %y) { 286530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_sle_nonneg_nz( 287530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 288530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 289*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 290530bbc8fSNoah Goldstein; 291530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 292530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 293530bbc8fSNoah Goldstein %cmp = icmp sle i8 1, %v 294530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 295530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 296530bbc8fSNoah Goldstein ret i1 %r 297530bbc8fSNoah Goldstein} 298530bbc8fSNoah Goldstein 299530bbc8fSNoah Goldsteindefine i1 @select_v_sle_fail(i8 %v, i8 %y) { 300530bbc8fSNoah Goldstein; CHECK-LABEL: @select_v_sle_fail( 301530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 302530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 303530bbc8fSNoah Goldstein; CHECK-NEXT: [[CMP:%.*]] = icmp sle i8 0, [[V:%.*]] 304530bbc8fSNoah Goldstein; CHECK-NEXT: [[S:%.*]] = select i1 [[CMP]], i8 [[V]], i8 [[Y]] 305530bbc8fSNoah Goldstein; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[S]], 0 306530bbc8fSNoah Goldstein; CHECK-NEXT: ret i1 [[R]] 307530bbc8fSNoah Goldstein; 308530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 309530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 310530bbc8fSNoah Goldstein %cmp = icmp sle i8 0, %v 311530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %v, i8 %y 312530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 313530bbc8fSNoah Goldstein ret i1 %r 314530bbc8fSNoah Goldstein} 315530bbc8fSNoah Goldstein 316530bbc8fSNoah Goldsteindefine i1 @inv_select_v_sle_nonneg(i8 %v, i8 %y) { 317530bbc8fSNoah Goldstein; CHECK-LABEL: @inv_select_v_sle_nonneg( 318530bbc8fSNoah Goldstein; CHECK-NEXT: [[YNZ:%.*]] = icmp ne i8 [[Y:%.*]], 0 319530bbc8fSNoah Goldstein; CHECK-NEXT: call void @llvm.assume(i1 [[YNZ]]) 320*2622b2f4SNoah Goldstein; CHECK-NEXT: ret i1 false 321530bbc8fSNoah Goldstein; 322530bbc8fSNoah Goldstein %ynz = icmp ne i8 %y, 0 323530bbc8fSNoah Goldstein call void @llvm.assume(i1 %ynz) 324530bbc8fSNoah Goldstein %cmp = icmp sle i8 %v, 0 325530bbc8fSNoah Goldstein %s = select i1 %cmp, i8 %y, i8 %v 326530bbc8fSNoah Goldstein %r = icmp eq i8 %s, 0 327530bbc8fSNoah Goldstein ret i1 %r 328530bbc8fSNoah Goldstein} 329