From: Chris Lattner Date: Fri, 24 Sep 2004 15:18:43 +0000 (+0000) Subject: Add some tests for shr-and folding X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=71dd80105531c7d1df9719be03abd0e55f7e98b4;p=oota-llvm.git Add some tests for shr-and folding git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16507 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/and.ll b/test/Transforms/InstCombine/and.ll index 703dea3326c..ba30d816df1 100644 --- a/test/Transforms/InstCombine/and.ll +++ b/test/Transforms/InstCombine/and.ll @@ -119,3 +119,20 @@ bool %test18(int %A) { ret bool %C } +int %test19(int %A) { + %B = shl int %A, ubyte 3 + %C = and int %B, -2 ;; Clearing a zero bit + ret int %C +} + +ubyte %test20(ubyte %A) { + %C = shr ubyte %A, ubyte 7 + %D = and ubyte %C, 1 ;; Unneeded + ret ubyte %D +} + +sbyte %test21(sbyte %A) { + %C = shr sbyte %A, ubyte 7 ;; sign extend + %D = and sbyte %C, 1 ;; chop off sign + ret sbyte %D +}