From 14cdf1968f0fc5463799c234a21876f6c5434345 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Fri, 19 Aug 2016 15:21:45 +0000 Subject: [PATCH] [InstCombine] add missing tests for basic icmp folds These are implicitly included as part of larger test cases, but they don't exist stand-alone (and don't happen for vectors...). llvm-svn: 279257 --- llvm/test/Transforms/InstCombine/icmp.ll | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index b1f5e50..2d2dfb5 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -2581,3 +2581,22 @@ define i1 @PR27792_2(i128 %a) { ret i1 %b } +define i1 @ugtMaxSignedVal(i8 %a) { +; CHECK-LABEL: @ugtMaxSignedVal( +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 %a, 0 +; CHECK-NEXT: ret i1 [[CMP]] +; + %cmp = icmp ugt i8 %a, 127 + ret i1 %cmp +} + +define i1 @ugtKnownBits(i8 %a) { +; CHECK-LABEL: @ugtKnownBits( +; CHECK-NEXT: [[B:%.*]] = and i8 %a, 17 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[B]], 17 +; CHECK-NEXT: ret i1 [[CMP]] +; + %b = and i8 %a, 17 + %cmp = icmp ugt i8 %b, 16 + ret i1 %cmp +} -- 2.7.4