1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -instcombine < %s | FileCheck %s 3 4declare i8 @llvm.umin.i8(i8, i8) 5declare i8 @llvm.umax.i8(i8, i8) 6declare i8 @llvm.smin.i8(i8, i8) 7declare i8 @llvm.smax.i8(i8, i8) 8 9define i8 @umin_known_bits(i8 %x, i8 %y) { 10; CHECK-LABEL: @umin_known_bits( 11; CHECK-NEXT: ret i8 0 12; 13 %x2 = and i8 %x, 127 14 %m = call i8 @llvm.umin.i8(i8 %x2, i8 %y) 15 %r = and i8 %m, -128 16 ret i8 %r 17} 18 19define i8 @umax_known_bits(i8 %x, i8 %y) { 20; CHECK-LABEL: @umax_known_bits( 21; CHECK-NEXT: ret i8 -128 22; 23 %x2 = or i8 %x, -128 24 %m = call i8 @llvm.umax.i8(i8 %x2, i8 %y) 25 %r = and i8 %m, -128 26 ret i8 %r 27} 28 29define i8 @smin_known_bits(i8 %x, i8 %y) { 30; CHECK-LABEL: @smin_known_bits( 31; CHECK-NEXT: ret i8 -128 32; 33 %x2 = or i8 %x, -128 34 %m = call i8 @llvm.smin.i8(i8 %x2, i8 %y) 35 %r = and i8 %m, -128 36 ret i8 %r 37} 38 39define i8 @smax_known_bits(i8 %x, i8 %y) { 40; CHECK-LABEL: @smax_known_bits( 41; CHECK-NEXT: ret i8 0 42; 43 %x2 = and i8 %x, 127 44 %m = call i8 @llvm.smax.i8(i8 %x2, i8 %y) 45 %r = and i8 %m, -128 46 ret i8 %r 47} 48